我收到以下错误:
Strict (2048): Non-static method Controller::referer() should not be called statically,
assuming $this from incompatible context [APP/View/Questions/admin_edit.ctp, line 20]
由此引起的:
//in app/View/Questions/admin_edit.ctp
echo $this->Html->link('Cancel', Controller::referer() );
为什么?
最佳答案
你不知道。您改用请求对象:
$this->request->referer();
Controller 内部什么都不做。
注意:referer 可以为空,因此在这种情况下您可能希望在此处提供后备。
另请注意可选参数 $local:
@param boolean $local 如果为真,则将引用 URL 限制为本地服务器
关于php - CakePHP:如何在 View 中使用 Controller::referer(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16069998/