我創造CakePHP中的一個殼,從模型打印數據,下面這個教程的Creating Shells & Taskscronjobs CakePHP的,需要幫助
class ReportShell extends Shell {
var $uses = array('Report');
function main() {
$reports = $this->Report->findAll();
foreach($reports as $report) {
$this->out('Report Name: ' . $report['Report']['name'] . "\n");
}
$this->out("Total Reports: " . count($reports) . "\n");
}
}
但後來當我在控制檯上輸入$cake report
,我得到這個錯誤消息:
Fatal error: Unable to load DataSource file dbo\dbo_mysql_ex.php in
C:\xampp\htdocs\cake_test\core\cake\libs\model\connection_manager.php on line 178
任何想法我應該如何解決這個問題?
更新: 以下@olezhek建議,我已編輯我的database.php文件,並使用「mysql」,而不是「mysql_ex」,我確實得到了一個不同的錯誤消息,其中指出,我有一個未定義的函數模型,我甚至沒有加載我的報告外殼,這怎麼可能?
感謝
注:我有表(報告),字段和條目一起建立數據庫,我管理,查看使用瀏覽器的表項。
要粘貼新的錯誤? – dogmatic69 2011-04-07 14:54:35