How to use PHP output as HTML code in the page

Conversion between HTML string and the htmlentities main application () function to complete

<?php

header("Content-Type: text/html; charset=utf-8");

$str="<a href=\"www.wyzdjg.top\">末末博客</a>";

echo $str;

echo "<br>";

echo htmlentities($str,ENT_QUOTES,"UTF-8");

?>

In applying this function string into a string of HTML process set parameters charset character set is utf-8, i.e., to avoid distortion in the output Chinese characters.

htmlentities () function to convert characters to HTML entities.

Tip: put HTML entities back to character, use html_entity_decode () function.

Tip: to return htmlentities () using the translation table using get_html_translation_table () function.

Guess you like

Origin www.cnblogs.com/mo3408/p/12652406.html