可能重复:
“不能将字符串偏移量用作数组”错误
<?php
$marks = 0;
$total = $_POST["lines"];
$quesA = $_POST["ques"];
$quesNo = 1;
$opt = array("","A","B","C","D");
for ($i = 0; $i < $total; $i++)
{
$q = $quesA[$i][0]; // here error
...
在这里,我现在分配$quesA = $_POST["ques"];
它需要一个变量$q = $quesA[$i][0];
,然后在线打印
echo "<div><b style='color:red;'>Q" . $quesNo . " : </b>"
. "<span style='color:blue;'>" . $q ."</span></div>"
;