0

所以我有以下控制器:

    class ForwardsController extends AppController
{
    public $uses = array('Offer', 'ExceptionUrl', 'Forward', 'Brand', 'MyModel, Website');
    public $components = array('RequestHandler', 'HasOffers', 'BloglicHelper', 'Paginator', /*'DebugKit.Toolbar'*/);
    public $categories = array();
    public $helpers = array('Js' => array('Jquery'), 'Paginator');

    public function beforeFilter()
    {
        parent::beforeFilter();
    }

}

现在,当我尝试执行以下操作时:

     $web = $this->Website->find('all');

我收到以下错误:

2013-09-09 10:08:14 Error: Fatal Error (1): Call to a member function find() on a non-object
4

1 回答 1

1

您必须在查找之前加载网站模型。

$this->loadModel('Website'); // add this line
$web = $this->Website->find('all');
于 2013-09-09T08:22:02.747 回答