我想在某些情况下(如1 )显示一个信息页面。客户组ID为2 2。客户登录
如果这两个条件满足,则显示信息页(id-12) Course1。
我正在目录/控制器/Inform.php中尝试这样做。
$id = $this->customer->getGroupId();
if (($this->customer->isLogged()) && ($information_id == 12) && ($id==2)) {
$this->redirect($this->url->link('account/account', '', 'SSL'));
}但是这不起作用,导致错误致命错误:调用未定义的方法
我要走错路了。请建议
发布于 2016-03-10 11:46:40
使用$this->response->redirect($this->url->link('account/account', '', 'SSL'));
而不是$this->redirect($this->url->link('account/account', '', 'SSL'));
编辑
redirect()方法在class Response中定义。只有在当前类中定义了$this->redirect()方法时,才能执行redirect()。
编辑2
如果只想显示登录客户的信息页面,请尝试此条件。
if (!$this->customer->isLogged()) {
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
}把它放在后面
public function index() { ...https://stackoverflow.com/questions/35915274
复制相似问题