Solution to the problem that php does not parse html tags: 1. Use PHP to set the encoding "charset=utf-8"; 2. Use the meta tag to set "".
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
What should I do if php does not parse the html tag?
php echo html content has been parsed, what is going on, as shown in Figure
View code
<?php header('Content-Type:text/plain;charset=utf-8'); echo "helloword"; echo "<hr>"; ?>
After checking, it is affected by the code header('Content-Type: text/plain;charset=utf-8');.
Here we need to distinguish between text/html and text/plain: text/html is output in the form of html, for example, a text box will be displayed on the page, and in plain form, this paragraph will be displayed on the page as it is. Code
Then there are two ways to modify it
1. Use PHP to set the encoding
<?php header("Content-type: text/html; charset=utf-8"); echo "<a href='http://s.jf3q.com'>helloword</a>"; echo "<hr>"; ?>
2. Use meta tag
<meta charset="UTF-8"> <?php echo "helloword"; echo "<hr>";?>
Recommended study: "PHP Video Tutorial"
The above is the detailed content of What to do if php does not parse html tags. For more information, please follow other related articles on the PHP Chinese website!