WorkersController.php
次のような検索方法があります。
public function search() {
$conditions = array();
if(!empty($this->request->data)){
foreach($this->request->data['Search'] as $field => $search_condition ) {
if(!empty($search_condition))
$conditions["$field LIKE "] = "%$search_condition%";
}
}
if(!empty($conditions)){
$this->Worker->recursive = 0;
$workers = $this->Worker->find('all',array('conditions' => $conditions));
}
$this->redirect(array('action' => 'index','search' ));
}
私が呼び出すメソッドでredirect()
、ページは次のようindex.ctp
に取得したい場所に移動します$workers
。
if($this->request->params['pass']==array('search')){
if (empty($workers)){
echo('No result found!');
}else{
foreach ($workers as $worker){
//do something
}
}
}
しかし、私は fetch できません。どうすれば からに$workers
渡すことができますか?search()
index.ctp
どうもありがとう!