$emptyStr = ".........";
$whichwrong .= "{$Ss[$s]}\n";
$whichwrong .= $emptyStr . "Question: $questionNum || Answer: {$userAnswers[$s][$q]}\n";
打印出来:
1. Medication Errors:
.........Question: 2 || Answer: b
.........Question: 4 || Answer: b
2. About Restraints:
.........Question: 3 || Answer: c
3. About Pain Assessment And Management:
.........Question: 2 || Answer: c
.........Question: 3 || Answer: b
4. About Universal Protocol:
.........Question: 1 || Answer: b
.........Question: 2 || Answer: b
我希望放置空格而不是“。” 我做了以下但是没有用:
$emptyStr = "";
$whichwrong .= str_pad($emptyStr, 10) . "Question: $questionNum || Answer: {$userAnswers[$s][$q]}\n";
但它没有包括“问题......”之前的10个空格
知道怎么解决吗?
更新[已解决] : 我使用了以下内容并且有效:
$whichwrong .= "<span style='padding-left: 25px;'></span>" . "Question: $questionNum || Answer: {$userAnswers[$s][$q]}\n";
答案 0 :(得分:2)
由于浏览器正在显示您要使用HTML的输出(Web浏览器会折叠空白区域)。在输出周围使用标记,或在代码中使用不间断空格(
)以获得所需结果。