У меня две модели: «галерея» и «образ». Когда я пытаюсь извлечь изображения из galleries_controller я вижу эту ошибку:Как устранить уведомление об ошибке «Неопределенная переменная» в PHP?
Notice (8): Undefined variable: images [APP\controllers\galleries_controller.php, line 25]
Я использую метод find
CakePHP, чтобы ограничить результаты изображения.
Вот мой galleries_controller:
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid image', true));
$this->redirect(array('action' => 'index'));
}
$this->set('gallery', $this->Galley->read(null, $id));
/// this code have some problem ///
$this->loadModel('image');
$Images= $this->Image->find('all',
array(
'limit' => 2, //int
)
);
$this->set('images', $images);
}
'$ this-> loadModel ('image');' строка 25? –
$ this-> set ('images', $ images); в строке 25 – user1080247