cakephp index.ctp文件语法错误

时间:2017-07-10 09:53:49

标签: cakephp

它向我显示错误: -

  

错误:语法错误,意外'=>' (T_DOUBLE_ARROW)文件   C:\ Windows \ System32 \ myapp1 \ src \ Template \ Myapp1 \ index.ctp行:50

第50行如下: -

<li><?= $this->Html->link(__('List <%= $this->_pluralHumanName($alias) %>'),['controller '] => '<%= $details['controller'] %>','action' => 'index']) ?></li>

我需要在这做什么?

2 个答案:

答案 0 :(得分:0)

请检查路由...您写了[&#39; controller&#39;] =&gt;

myRepository.Where(x => DateTime.Now.AddYears(-fromAge) <= x.BirthDate && x.BirthDate <= DateTime.Now.AddYears(-toAge)).ToList();

应该是,

<li><?= $this->Html->link(__('List <%= $this->_pluralHumanName($alias) %>'),['controller '] => '<%= $details['controller'] %>','action' => 'index']) ?></li>

答案 1 :(得分:0)

  

它说:错误:语法错误,意外'控制器'(T_STRING),   期待']'文件   C:\ Windows \ System32 \ myapp1 \ src \ Template \ Myapp1 \ index.ctp行:51

请检查index.ctp,']'未给出。或者再次分享您的代码