Home >Backend Development >PHP Problem >php does not parse html code
php does not parse html code?
php echo html content is parsed, what is going on, as shown in the figure
<?php header('Content-Type:text/plain;charset=utf-8'); echo "helloword"; echo "<hr>"; ?>
After checking, it is because 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, while in plain form it will be output as it is on the page. Display this code
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='xxx'>helloword</a>"; echo "<hr>"; ?>
2. Use meta tags
<meta charset="UTF-8"> <?php echo "helloword"; echo "<hr>"; ?>
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of php does not parse html code. For more information, please follow other related articles on the PHP Chinese website!