Note PHP.ini MAGIC_QUOTES_GPC in the configuration file, what is the role of magic_quotes_runtime? Should I turn it on or off?

Source: Internet
Author: User

By default, PHP instruction MAGIC_QUOTES_GPC is on, and automatically runs Addslashes () for all GET, POST, and COOKIE data. Do not use Addslashes () for strings that have been MAGIC_QUOTES_GPC escaped, because this results in double-layer escaping. You can use the function GET_MAGIC_QUOTES_GPC () to detect this situation.

PHP Magic_quotes_gpc=on: We can not do the input and output database string data for addslashes () and stripslashes () operation, the data will be displayed normally.
When you addslashes () the input data, you must use Stripslashes () to remove the extra backslash when you output it.
PHP Magic_quotes_gpc=off: The input data is processed using addslashes (), but it is not necessary to format the output with Stripslashes () because addslashes () does not write the backslash together with the database. Just to help MySQL complete the execution of the SQL statement.
Magic_quotes_runtime escape characters: When you have some characters in your data that you want to write to the database, and you want to not be filtered out, it can be useful to add the characters in front of them.

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.