我看我的聯繫指數CakePHP的:調用一個成員函數find()方法非對象
Notice (8): Undefined property: ClientsController::$Clients [APP/controllers/clients_controller.php, line 27]
Call to a member function find() on a non-object in /Users/cameron/Sites/crm/app/controllers/clients_controller.php on line 27
這裏時,遇到下列錯誤的是代碼:
class ClientsController extends AppController
{
var $name = 'Clients';
function beforeFilter()
{
parent::beforeFilter();
$this->Auth->allow(array('*'));
}
function index()
{
$this->set('clients', $this->Clients->find('all'));
}
function view ($id, $slug)
{
$article = $this->Clients->read(null, Tiny::reverseTiny($id));
$this->set(compact('client'));
}
function admin_index()
{
$this->set('clients', $this->Clients->find('all'));
}
任何想法問題在這裏? (我創建了一個模型還)
我試過上面提到的解決方案,但它不起作用。對我來說,問題是在4種可能的情況中,只有一種情況顯示此錯誤,其餘3種正常工作。 –