Home >Backend Development >PHP Problem >php does not parse html code

php does not parse html code

藏色散人
藏色散人Original
2019-10-18 10:07:164065browse

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 does not parse html code

<?php
    header(&#39;Content-Type:text/plain;charset=utf-8&#39;);
    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=&#39;xxx&#39;>helloword</a>";
    echo "<hr>"; 
?>

2. Use meta tags

<meta charset="UTF-8">
 <?php
        echo "helloword";
    echo "<hr>";
    ?>

php does not parse html code

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn