1

我收到一条错误消息:

解析错误:语法错误,意外的 T_VARIABLE in .... 第 599 行

属于以下行:

foreach ($questions as $key=>$question) {

    echo '<p><strong>Question:</strong> ' .htmlspecialchars($row_question['question_num'][$key]). ': ' .htmlspecialchars($row_question['question_content']$key]). '</p>' . PHP_EOL;

    }

我做错了什么?

下面是代码:

    $question = array();

    while ($selectedstudentanswerstmt->fetch()) {

    $row_question = array();
    $row_question['question_num'] = $detailsQuestionNo;
    $row_question['question_content'] = $detailsQuestionContent;
    $row_question['question_option'] = $detailsOptionType;
    $row_question['question_num_answers'] = $detailsNoofAnswers;
    $row_question['question_answer'] = $detailsAnswer;
    $row_question['questionnum_reply'] = $detailsReplyType;
    $row_question['questionnum_marks'] = $detailsQuestionMarks;
    $questions[] = $row_question;
}

.................

<?php   

          foreach ($questions as $key=>$question) {

echo '<p><strong>Question:</strong> ' .htmlspecialchars($row_question['question_num'][$key]). ': ' .htmlspecialchars($row_question['question_content']$key]). '</p>' . PHP_EOL;

}
?>
4

1 回答 1

3

你少了一个括号

    echo '<p><strong>Question:</strong> ' .htmlspecialchars($row_question['question_num'][$key]). ': ' .htmlspecialchars($row_question['question_content']$key]). '</p>' . PHP_EOL;

应该

    echo '<p><strong>Question:</strong> ' .htmlspecialchars($row_question['question_num'][$key]). ': ' .htmlspecialchars($row_question['question_content'][$key]). '</p>' . PHP_EOL;
于 2013-02-06T02:39:38.930 回答