我的代码
b.php
<?php
namespace B;
use Swoole\Http\Server;
$http = new Server('0.0.0.0','9049');
$http->on("request",function(swoole_http_request $request,swoole_http_response $response) {//俩参数 一个请求 一个响应
print_r($request);
$response->end("b");
});
$http->start();
启动后在浏览器里http://101.201.66.130:9049 然后服务器里就会卡住报错
PHP Fatal error: Uncaught TypeError: Argument 1 passed to B\x::B\{closure}() must be an instance of B\swoole_http_request, instance of Swoole\Http\Request given in /usr/local/nginx/html/mySwoolePhp/bin/b.php:7
但是如果把namespace B;注释掉就不会报错了
请问谁知道这是咋回事吗
b.php
<?php
namespace B;
use Swoole\Http\Server;
$http = new Server('0.0.0.0','9049');
$http->on("request",function(swoole_http_request $request,swoole_http_response $response) {//俩参数 一个请求 一个响应
print_r($request);
$response->end("b");
});
$http->start();
启动后在浏览器里http://101.201.66.130:9049 然后服务器里就会卡住报错
PHP Fatal error: Uncaught TypeError: Argument 1 passed to B\x::B\{closure}() must be an instance of B\swoole_http_request, instance of Swoole\Http\Request given in /usr/local/nginx/html/mySwoolePhp/bin/b.php:7
但是如果把namespace B;注释掉就不会报错了
请问谁知道这是咋回事吗