OpenCart没有重定向到登录页面

时间:2017-01-26 13:11:20

标签: php opencart2.3

如果用户未登录并且他访问了愿望清单页面。(http://website/index.php?route=account/wishlist)他应该重定向到登录页面(http://website/index.php?route=account/login),但是他会停留在同一页面上并显示空白

这是控制器代码

class ControllerAccountWishList extends Controller {
public function index() {
    if (!$this->customer->isLogged()) {
        $this->session->data['redirect'] = $this->url->link('account/wishlist', '', true);

        $this->response->redirect($this->url->link('account/login', '', true));
    }
  }
}

1 个答案:

答案 0 :(得分:0)

我找到了解决方案

重定向到心愿单或帐户时,已发送标题错误。我通过添加ob_start()&修复了这个问题。 OpenCart根目录下的index.php文件中的ob_flush()。