有人能告訴我爲什麼這個代碼可以在我的本地服務器上工作,但不是與godaddy?我得到GoDaddy的下面的錯誤...在localhost上工作的語法,不在godaddy服務器上工作
Parse error: syntax error, unexpected '[' in /home/content/20/10592020/html/foodport/application/controllers/register.php on line 41
這裏是我的user_model
的get_userId
功能。
public function get_userId(){
$results = $this->obtain_user_info('users', array('username'=>$this->username), true);
if(count($results) > 0)
{
return $results;
}else
{
return array("user_id" => GUEST_ID);
}
}
這裏是obtain_user_info
功能:
private function obtain_user_info($table, $params, $assoc = false){
$query = $this->db->get_where($table, $params);
if(!$assoc){
$results = $query->result();
}else
{
$results = $query->row_array();
}
return $results;
}
這裏是我的註冊控制器代碼具體線路41
$user_id = $user->get_userId()['user_id'];
我不明白get_userId()['user_id'],我喜歡get_userId($ someVariable)。都一樣嗎?如果你能向我解釋或提供解釋鏈接,我會很感激。 thanx –
在線和本地檢查php版本 – umefarooq