如何在下面的回声上应用css ?在我添加UTF编码的标题之前我让它工作了但是现在它也响应css所以我的响应结果是:<p align='center'>Good!!!</p>
<?php
header('Content-type: text/plain; charset=utf-8');
$answer = $_POST['1'];
if ($answer == "YES") {
echo 'Good!!!';
}
else {
echo 'Try Again!';
}
?>
纠正:
<?php
header('Content-type: text/html; charset=utf-8');
$answer = $_POST['1'];
if ($answer == "YES") {
echo "<p align='center'>Good!!!</p>";
}
else {
echo "<p align='center'>Try Again!</p>";
}
?>
你正在发送标题:
Content-type: text/plain;
,它告诉浏览器传入的数据是纯文本,而不是HTML,因此返回数据中的任何标记都将被忽略。