workerman 3.x可以使用 Workerman\Protocols\Http::header('Location: .....'); 这个函数作为跳转网站 workerman 4.1要怎么实现以上的功能呢?
use Workerman\Worker; use Workerman\Protocols\Http\Response; require_once './Workerman/Autoloader.php'; $worker = new Worker('http://0.0.0.0:8080'); $worker->onMessage = function($connection, $request) { $response = new Response(302, ['Location' => $location]); $connection->send($response); }; // 运行worker Worker::runAll();
试下
可以了,谢谢
试下
可以了,谢谢