"."/> ".">
Home > Article > Backend Development > What should I do if the php output html code is not parsed?
Solution to the problem that the html code output by php is not parsed: 1. Use PHP to set the encoding, code such as "header("Content-type:...charset=utf-8")"; 2. Use meta tags Set encoding, code such as "".
The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer
What should I do if the html code output by php does not parse? ?
php echo html content was parsed, what happened, as shown in the figure
##
<p><?php<br/> header('Content-Type:text/plain;charset=utf-8'); echo "helloword"; echo "<hr>"; <br/>?><br/></p>After checking, it is because of header(' Content-Type: text/plain;charset=utf-8'); This sentence of code affects it.
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
<p> <?php<br/> header("Content-type: text/html; charset=utf-8"); <br/> echo "<a href='http://s.jf3q.com'>helloword</a>"; echo "<hr>"; <br/>?><br/></p>2. Use meta tag
<p> <meta charset="UTF-8"><br/> <?php<br/> echo "helloword"; echo "<hr>";?><br/></p>Recommended learning: "
PHP Video Tutorial"
The above is the detailed content of What should I do if the php output html code is not parsed?. For more information, please follow other related articles on the PHP Chinese website!