報錯
PHP Parse error: syntax error, unexpected '?' in /home/jyp/vendor/workerman/phpsocket.io/src/SocketIO.php on line 23
Parse error: syntax error, unexpected '?' in /home/jyp/vendor/workerman/phpsocket.io/src/SocketIO.php on line 23
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
use PHPSocketIO\SocketIO;
// 创建socket.io服务端,监听3120端口
$io = new SocketIO(3120);
// 当有客户端连接时打印一行文字
$io->on('connection', function($socket)use($io){
echo "new connection coming\n";
});
Worker::runAll();
php sk_test1.php start
解决了。PHP切换命令行版本7.0以上就行了