标签:tle echo class operator array world 回调函数 ora ble
$server->on(‘Request‘, function ($req, $resp) use ($a, $b, $c) {
echo "hello world";
});
可使用
use
向匿名函数传递参数
class A
{
static function test($req, $resp)
{
echo "hello world";
}
}
$server->on(‘Request‘, ‘A::Test‘);
$server->on(‘Request‘, array(‘A‘, ‘Test‘));
function my_onRequest($req, $resp)
{
echo "hello world";
}
$server->on(‘Request‘, ‘my_onRequest‘);
class A
{
function test($req, $resp)
{
echo "hello world";
}
}
$object = new A();
$server->on(‘Request‘, array($object, ‘test‘));
标签:tle echo class operator array world 回调函数 ora ble
原文地址:https://www.cnblogs.com/php-linux/p/9969696.html