It's a bug? What should I do?

Source: Internet
Author: User
It's a bug. why ??? A specific statement $ str = '& lt; pre & gt; & lt; spanstyle = & quot; color: red & quot; & gt; 123 & lt;/span & gt; & lt;/pre & gt; '; when the database is inserted, it is a bug ???
A statement

$ Str ='
123
';

When I inserted the database, I printed it out and watched the source code,

What's strange is that

After the database is saved, the source code becomes

123


This is what is stored in the database. it's really a bad idea ....

Is it a bug ??

------ Solution --------------------
I printed the SQL statement.
-----------------------
Check the output in the source code of the browser.
No conversion?
------ Solution --------------------

Check whether the database data is normal.
Abnormal Check:
Echo $ SQL is not materialized before INSERT.

Normal:
It is the physical output.
------ Solution --------------------
Escape characters.

Use the addslashes function to insert data into the database. use the stripslashes function to restore the data to normal.
------ Solution --------------------
The TP database is automatically processed.
------ Solution --------------------
I agree that the upstairs is to prevent SQL injection attacks. The escape added last time is useless. But it seems that the "<" and "> "(.
) To "& \ lt", "& \ gt ". In this way, the code is correctly displayed and the code is not executed.
------ Solution --------------------
You used thinkphp and thinkphp to insert and convert tags.

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.