私は次の(取り除いた)コードを持っています:
$question = fetch_question($conn, $current_question);
var_dump($question);
echo $question["_id"];
fetch_question()
$conn
データベース接続を使用して、上の配列を取得します$current_question
。
これにより、次の出力が得られます。
array(1) {
[0]=>
array(7) {
["_id"]=>
string(1) "1"
["question"]=>
string(10) "What's 2+2"
["answer1"]=>
string(1) "1"
["answer2"]=>
string(1) "2"
["answer3"]=>
string(1) "3"
["answer4"]=>
string(1) "4"
["is_right"]=>
string(1) "4"
}
}
<br />
<b>Notice</b>: Undefined index: _id in <b>D:\Websites\htdocs\tests\general.php</b> on line <b>76</b><br />
今、私はこれが非常に独特で_id
あることに気づき、明確に定義されています。PHPがこのように動作する理由がわかりません。
どんな助けでもいただければ幸いです!