本文操作环境:windows7系统、PHP7.1版,DELL G3电脑php 输出html 代码不解析怎么办?php echo html的内容被解析了,是怎么回事呢,如图<?php header('Content-Typ
本文操作环境:windows7系统、PHP7.1版,DELL G3电脑
php 输出html 代码不解析怎么办?
php echo html的内容被解析了,是怎么回事呢,如图
<?php
header('Content-Type:text/plain;charset=utf-8'); echo "helloWord"; echo "<hr>";
?>
检查之后是因为header(‘Content-Type:text/plain;charset=utf-8’);这一句代码影响的。
在这里要区分一下text/html和text/plain:text/html是以html的形式输出,比如就会在页面上显示一个文本框,而以plain形式就会在页面上原样显示这段代码
那么修改方式能有两种
用PHP设置编码
<?php
header("Content-type: text/html; charset=utf-8");
echo "<a href='Http://s.jf3q.com'>helloword</a>"; echo "<hr>";
?>
用meta标签
<meta charset="UTF-8">
<?php
echo "helloword"; echo "<hr>";?>
以上就是php 输出html 代码不解析怎么办的详细内容,更多请关注编程界其它相关文章!
--结束END--
本文标题: php 输出html 代码不解析怎么办
本文链接: https://www.lsjlt.com/news/180.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2023-09-28
2023-09-28
2023-09-28
2023-09-28
2023-09-28
2023-09-28
2023-09-28
2023-09-28
2023-09-28
2023-09-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
0