每次访问都地址,都只会显示第一次请求路径的返回结果
来源:7-13 登录实现(二)
慕标9786616
2018-04-06
比如:第一次 访问 http://singwa.swoole.com:8811/?s=index/login/index&phone_num=234&code=234234,返回login接口的响应
但是 第二次访问 http://singwa.swoole.com:8811/?s=index/send/index&phone_num=234 还是返回login接口的响应,顺序交换也没用
只有重启swoole服务才能换一次地主,但还是上面的结果
1.tp源码改了

2.Ws.php

public function onRequest($request,$response)
{
$_GET = [];
$_POST = [];
$_FILES = [];
$_SERVER = [];
if(isset($request->server)) {
foreach ($request->server as $k=>$v) {
$_SERVER[strtoupper($k)] = $v;
}
}
if(isset($request->header)) {
foreach ($request->header as $k=>$v) {
$_SERVER[strtoupper($k)] = $v;
}
}
if(isset($request->get)) {
foreach ($request->get as $k=>$v) {
$_GET[$k] = $v;
}
}
if(isset($request->files)) {
foreach ($request->files as $k=>$v) {
$_FILES[$k] = $v;
}
}
if(isset($request->post)) {
foreach ($request->post as $k=>$v) {
$_POST[$k] = $v;
}
}
ob_start();
$_POST['ws_server'] = $this->ws;
try{
think\Container::get('app', [defined('APP_PATH') ? APP_PATH : ''])
->run()
->send();
}catch (\Exception $e) {
echo $e->getMessage();
}
$res = ob_get_contents();
ob_end_clean();
$response->end($res);
}写回答
2回答
-
慕标9786616
提问者
2018-04-06
搞定了 原来 有两个,都要注释

10 -
慕标9786616
提问者
2018-04-06
我在 index/index/index 中打印 dump(request()->path()); 不同路径 确实是不一样的,但是
00
相似问题

