您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php 输出html 代码不解析怎么办

2024/3/12 4:06:11发布32次查看
php输出html代码不解析的解决办法:1、用php设置编码,代码如“header(content-type:...charset=utf-8)”;2、用meta标签设置编码,代码如“0d94b2dad07259293dd606022eaa23d8”。
本文操作环境: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形式就会在页面上原样显示这段代码
那么修改方式能有两种
1、用php设置编码
<?php
header("content-type: text/html; charset=utf-8");
echo "<a href='http://s.jf3q.com'>helloword</a>"; echo "<hr>";
?>

2.用meta标签
<meta charset="utf-8">
<?php
echo "helloword"; echo "<hr>";?>

推荐学习:《php视频教程》
以上就是php 输出html 代码不解析怎么办的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product