使用swoole_http_response方法header,status,end可以实现跳转
代码如下
public function redirect($url)
{
$this->header("Location", $url);
$this->status(302);
return $this->end('');
}
但是使用redirect()后,程序没有中断,还是继续往下执行,
后来我用抛出异常的的方法中断了程序,不让他继续往后执行,不过这样的方法造成worker重启,
问题: 有没有好的办法,页面跳转后,程序就马上中断,不会继续执行,页面马上跳转?要求不使用抛出异常的的方法中断程序
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
走同样的路,发现不同的人生