我寫了一個使用Cake-Shell方法「success()」的Cake-Shell,但是這被聲明爲undefined。我無法找到描述該問題的任何線程。我可以說殼幾周前運行得很好。Cake 2 Shell:未定義方法成功()
方法調用:
$this->success('success', array());
我打電話通過
cake ImportItems
及其顯然通過它運行,但拋出一個錯誤在我的Windows的命令行外殼時,應解僱$這個 - >成功():
Fatal error: Call to undefined method ImportItemsShell::success() in D:\xampp\htdocs\myCake\app\Console\Command\ImportItemsShell.php on line 29
這裏是我的殼牌
準則10require_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());
}
}
}