"."/> ".">

Home >Backend Development >PHP Problem >What to do if php does not parse html tags

What to do if php does not parse html tags

藏色散人
藏色散人Original
2021-07-12 10:48:483123browse

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 "".

What to do if php does not parse html tags

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
What to do if php does not parse html tags

View code

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

2. Use meta tag

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

What to do if php does not parse html tags

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!

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