public function isQuestion($query){
$questions = $this->getAllQuestions();
if (count($questions)){
foreach ($questions as $q){
if ($this->isQuestion$q($query)){
return $this->isQuestion$q($query);
}
}
}
return false;
}
錯誤:
Parse error: syntax error, unexpected T_VARIABLE in /Applications/XAMPP/xamppfiles/htdocs/ai/application/models/question_model.php on line 7
出現該問題上
if ($this->isQuestion$q($query)){
return $this->isQuestion$q($query);
我有一些功能,如isQuestion1,isQuestion2 ,isQuestion3等等......我調用另一個功能 * getAllQuestions *將返回我的問題,所有的數字陣列中的像1,2,3,4,5 ...然後我用上面的代碼檢查每個函數是否是基於查詢的問題
將它換成大括號'$ this-> isQuestion {$ q}($ query)' –