我在chrome上运行网站可以。但是在safari上运行时,错误如下:Safari无法打开页面。错误是:“该操作无法完成。协议错误”(NSPOSIXErrorDomain:100)。
我想出了解决方法,但不知道为什么。
发件人:
private function unauthorized()
{
$this->Controller->autoRender = false;
$this->Controller->response->header('WWW-Authenticate: Basic realm="Please enter your ID and password"');
$this->Controller->response->statusCode(401);
$this->Controller->response->send();
$this->Controller->_stop("id / password Required");
}
收件人:
private function unauthorized()
{
$this->Controller->autoRender = false;
$this->Controller->response->header('WWW-Authenticate: Basic realm="Please enter your ID and password"');
$this->Controller->response->send();
throw new BadRequestException('id / password Required', 401);
}
我正在使用cakephp。更改后,它正在运行。是什么原因?