(stderr: PHP Warning: Creating default object from empty value in /ww_work/base/exam_class.php on line 1785,)
我没有php程序员,但apache日志正在使用以下函数中的空值数组创建默认对象。
// this function put exam answer by student ito exm object.
// it also give the score to question if answer was correct.
public function put_answer($question_id,$answer_id){
$this->given_answer[$question_id]=$answer_id;
$question_obj = $this->questions[$question_id];
//$answer_obj = new stdClass();
$answer_obj = $question_obj->answer[$answer_id];
$answer_obj->given_answer="Y";
if(($answer_obj->given_answer==="Y")&&($answer_obj->correct_answer==="Y")){
$question_obj->given_mark=$given_mark + $question_obj->score;
$question_obj->given_answer=$answer_id;
$question_obj->question_result="right";
}else{
$question_obj->given_mark=$given_mark + 0;
//$answer_obj->given_answer="N";
}
}
正在$answer_obj->given_answer="Y";
行生成错误。
做一些谷歌搜索,我认为这可能是松散的连接 (Creating default object from empty value in PHP?)
但是如果有人对如何删除此警告有任何想法,除了关闭php警告之外,我们将不胜感激。