[['username'], 'filter', 'filter' => 'strtolower'],
[['username'], 'filter', 'filter' => function ($value) {
return strtolower($value);
}],
['username', 'filter', 'filter' => function ($value) {
return mb_strtolower($value);
}],
function checkStatus($link, $port){
if ( !fsockopen($link, $port, $errno, $errstr, 30) ) {
return ['color' => 'red', 'text' => 'OFFLINE', 'errno' => $errno, 'errstr' => $errstr ];
}
return ['color' => 'green', 'text' => 'ONLINE'];
}
$res = checkStatus('192.168.0.222', '29000');
echo "<font color='{$res['color']}' size='5'>{$res['text']}</font>";
жаль только, в ie new Event() не работает((
use Workerman\Worker;
use PHPSocketIO\SocketIO;
// listen port 2021 for socket.io client
$io = new SocketIO(2021);
$io->on('connection', function($socket)use($io){
$socket->on('chat message', function($msg)use($io){
$io->emit('chat message', $msg);
});
});
Worker::runAll();
php server.php start -d