Php transforms special html characters

Source: Internet
Author: User
Php conversion html special characters I wrote function conversion some special characters functionformat_html ($ str) {$ strstr_replace (& amp; ldquo;, ", $ str); $ strstr_replace (& amp; rdquo;, ", $ str); $ strstr_replace (& amp; middo php converts html special characters
Function I wrote

// Convert some special characters
Function format_html ($ str ){
$ Str = str_replace (',', $ str );
$ Str = str_replace ('"', '"', $ str );
$ Str = str_replace ('·', '·', $ str );
$ Str = str_replace (''', ''', $ str );
$ Str = str_replace (''', ''', $ str );
$ Str = str_replace ('... ','... ', $ Str );
$ Str = str_replace ('-', '-', $ str );
Return $ str;
}

However, there are too many symbols. About 255 online users. How can this problem be solved?

------ Solution --------------------
... You don't need to convert it like this. "When the webpage does not recognize the html language, this symbol will be displayed. if the page is full html,"

------ Solution --------------------
PHP code
Htmlspecialchars: $ htm ="

AB c

"; Echo htmlspecialchars ($ htm); # Source code # <p> AB c </p> # Page #

AB c

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.