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='xxx'>helloword</a>"; echo "<hr>"; ?>使用元标签
<meta charset="UTF-8"> <?php echo "helloword"; echo "<hr>"; ?>更多关于PHP的信息,请访问AdminJS!
以上是php不解析html代码的细节。更多详情请关注AdminJS的其他相关文章!