How does php make a log output as is? Solution

Source: Internet
Author: User
How does php make a log output as it is? I recently made a simple blog and posted an article from the back. it is always not displayed on the front end, and it is all right aligned, space has been converted into & nbsp; & amp; nbsp; and so on when inserting the database. publicfunctionstr_to ($ str) {$ str = str_replace (& quot ;, how does php make a log output as is?
I recently made a simple blog and published an article from the back. it is always not displayed on the front-end, and all are right aligned. spaces have been converted
, Public function str_to ($ str ){
$ Str = str_replace ("", "", $ str );
$ Str = str_replace ("<", "<", $ str );
$ Str = str_replace (">", ">", $ str );
$ Str = nl2br ($ str );
Return $ str;

}
Before inserting a database, you should first insert $ content (article content) $ content = str_to ($ content); and then insert all the text to the right alignment. isn't all the spaces replaced, sorry, please give me your answers !!!!!!!!!!!!!!!!!!

------ Solution --------------------
Replace these three statements with this function:
Htmlspecialchars ()
------ Solution --------------------
Then, your problem has nothing to do with php, but with html pages.

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.