1
$emptyStr = ".........";
$whichwrong .= "{$Ss[$s]}\n";
$whichwrong .= $emptyStr . "Question: $questionNum || Answer: {$userAnswers[$s][$q]}\n";
打印出: 「」使用str_pad()在PHP作爲標籤功能
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位「問題......」
不知道如何解決它?
UPDATE【解析】: 我用下面的和它的工作:
$whichwrong .= "<span style='padding-left: 25px;'></span>" . "Question: $questionNum || Answer: {$userAnswers[$s][$q]}\n";
您使用的是空字符串作爲填充而不是空間... – Pinoniq
你發這一個網頁瀏覽器(將多個空格減少爲單個空格字符),或在命令行? –
我正在使用Web瀏覽器。 – Si8