1.创建laravel自定义命令
php artisan make:command Haha
2.打开app/Console/Commands/Haha.php
<?php
namespace App\Console\Commands;
use App\Sockets\SmartCare\WristMixTcpClient;
use Illuminate\Console\Command;
class Haha extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'haha';
/**
* The console command description.
*
* @var string
*/
protected $description = 'test';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$mix_tcp = new WristMixTcpClient();//这个类文件将在下文贴出,你可以把这个文件放在任意目录,也可以取任意文件名,在头部引入即可.
$mix_tcp-&