我面臨幾個問題提供的foreach無效參數 - 創建一個功能等消息:笨的應用過程中笨
function searchUnivtab() {
$country = $this->input->post('countryKey');
$state = $this->input->post('stateKey');
$level = $this->input->post('level');
$degType = $this->input->post('degType');
$country = str_replace('%20', ' ', $country);
$state = str_replace('%20', ' ', $state);
$degType = explode('~', $degType);
$data = @$this->get->getSearchedUniversityTab($country, $state, $level, $degType[1]);
$html = '';
$i = 0;
foreach($data as $d)
{
$html .= '<option value="'.$d['name'].'">'.$d['name'].'</option>';
}
echo $html; die;
}
錯誤爲:A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
,
Line Number: 270
其在
foreach
線
任何與上述代碼有關的幫助?在下面的行
你確定更換
的$數據數組(我沒有使用codeigniter)? –
@NullPointer No sir,它不是數組,Print'數據不是數組'。 –
Okie,如果我刪除了,我如何獲取$ data的值?任何幫助?代碼與上面相同 - –