【发布时间】:2013-10-30 10:08:26
【问题描述】:
我编写了一个使用 Cake-Shell 方法“success()”的 Cake-Shell,但这被声明为未定义。我在网上找不到任何描述该问题的线程。我可以看出,shell 几周前确实运行良好。
方法调用:
$this->success('success', array());
我通过
在我的 Windows-CLI 中调用 shellcake ImportItems
它显然会通过它,但在应该触发 $this->success() 时会引发错误:
致命错误:调用未定义的方法 ImportItemsShell::success() in D:\xampp\htdocs\myCake\app\Console\Command\ImportItemsShell.php 第 29 行
这是我的 Shell 代码
require_once('libraries/Ini.php');
class ImportItemsShell extends AppShell {
/**
* Main fn
*/
public function main() {
$this->importItems();
}
/**
* Get called by Cron
*/
protected function importItems() {
$Shop= new Shop(SHOP_DB);
$items = Api::getItems(true);
$mysql = MySQL::getInstance();
$res = array();
if(is_array($items) && ($items['status'] == Api::STATUS_OK)) {
$Shop->importItems($items['values']);
$this->success('success', $items['values']);
} else {
$this->error('invalid_item_response', array());
}
}
}
【问题讨论】: