cakephp 模型中的附加方法导致 500 错误
嘿, 我正在尝试使用模型中的一些附加方法来优化几个 cakephp 控制器,但返回了 500 内部服务器错误。有人能指出我正确的方向吗?
模型:
function getID($id) {
$tmp = $this->find("all",array('conditions'=>array('Model.id'=>$id)));
return $tmp;
}
控制器:
function getTotalQuestions(){
$tmp=$this->Model->getID(7);
debug($tmp);
}
有时我不会收到 500 错误,但会收到一条错误消息,告诉我没有变量已传递给 getID。
任何帮助将不胜感激 塔夫
Hey,
I am trying to optimise a couple of cakephp controllers with some additional methods in the model but am getting a 500 Internal Server error returned. Can anyone point me in the right direction please?
Model:
function getID($id) {
$tmp = $this->find("all",array('conditions'=>array('Model.id'=>$id)));
return $tmp;
}
Controller:
function getTotalQuestions(){
$tmp=$this->Model->getID(7);
debug($tmp);
}
Occasionally I don't get a 500 error, but an error message telling me no variable has been passed to getID.
Any help would be greatly appreciated
Taff
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是你如何表述你的功能(最有可能)。您需要更改函数名称的格式:
看看 http://book.cakephp.org/view/908/Requirements#!/view/904/Controller-Conventions 了解更多详细信息。但它指出:
It is how you are wording your functions (most likely). You need to change the format of the function names:
Take a look at http://book.cakephp.org/view/908/Requirements#!/view/904/Controller-Conventions for more details. But it states: