私は「ギャラリー」と「イメージ」の2つのモデルを持っています。私は画像の結果を制限するために、CakePHPのfind
メソッドを使用しPHPで「未定義変数」の通知をトラブルシューティングするにはどうすればよいですか?
Notice (8): Undefined variable: images [APP\controllers\galleries_controller.php, line 25]
:私はgalleries_controllerから画像を取得しようとすると、私はこのエラーを参照してください。ここで
は私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