0
什麼是與此PHP解析錯誤意外「{」,希望「(」CodeIgniter的PHP解析錯誤意外「{」,希望「(」
沒有回溯,沒有任何其他的錯誤信息,只有一個符合控制器,這是它-_-
我一直在尋找解決方案,並閱讀與此相關的許多環節。
有什麼能爲我下面的代碼中的錯誤的原因..
這是我控制器代碼(這是做工精細):
if (isset($filter) && !empty($search)) {
$data['users'] = $this->model_search->searchTutor($field, $search);
}
elseif (($filter == 'subjName') && !empty($search)) {
$data['users'] = $this->model_search->searchBySubj($field, $search);
}
else {
$data['users'] = $this->model_search->getlist($field);
}
//later i wanted to add a code that will show No Result Found
我的網頁視圖文件開始給這個錯誤當我在我的控制器(search.php中)加入ELSEIF聲明:
if (isset($filter) && !empty($search)) {
$data['users'] = $this->model_search->searchTutor($field, $search);
}
elseif (($filter == 'subjName') && !empty($search)) {
$data['users'] = $this->model_search->searchBySubj($field, $search);
}
//so I added another elseif
elseif (isset($filter) && empty($search)) {
$data['users'] = $this->model_search->getlist($field);
}
//and put the No Result last
else {
$this->session->set_flashdata('nores','<div class="alert text-center">No result matched your search.</div>');
}
是因爲多個elseif條件還是我真的在這裏錯過了什麼?請幫忙..
感謝您指出我現在編輯它..但爲什麼它不顯示視圖中的flashdata?它應該回顯沒有結果... – Distro
@Distro這似乎是一個完全不同的問題。如果是這樣,你應該將這個問題標記爲已解決,並提出一個新問題。 – Carcigenicate
@Distro你在哪裏看到你的flash數據? –