我是 cakePHP 新手,请指教。
数据库名称是 admin_accounts。这里是数据。
类文件
<?php
App::uses('AppModel', 'Model');
class AdminAccount extends AppModel {
}
?>
控制器文件
<?php
class AdminAccountsController extends AppController{
public function profile($id = null){
if(!$id){ throw new NotFoundException(__('No profile')); }
$adminAccount = $ $this->AdminAccount->findById($id);
if (!$adminAccount) {
throw new NotFoundException(__('No profile'));
}
$this->set('admin_account', $adminAccount);
}
}
?>
当我调用配置文件时,它给了我这个错误
Warning (4096): Object of class AdminAccountsController could not be converted to string [APP/Controller/AdminAccountsController.php, line 15]
Notice (8): Object of class AdminAccountsController to string conversion [APP/Controller/AdminAccountsController.php, line 15]
Notice (8): Undefined variable: Object [APP/Controller/AdminAccountsController.php, line 15]
Notice (8): Trying to get property of non-object [APP/Controller/AdminAccountsController.php, line 15]
Fatal error: Call to a member function findById() on a non-object in /home/crayzest/public_html/cake/app/Controller/AdminAccountsController.php on line 15
我做错了什么?