PHP Magic Quotes

Source: Internet
Author: User
Tags php script

Today found that the program relay code over the string has 3/escape characters appear, after the investigation, is the PHP configuration in the MAGIC_QUOTES_GPC open, the $_post data automatically converted, and then the program is converted, which appears above, the following is a PHP manual about magic Introduction of quote.

-------------------------------------------------------------------------

Magic quotes (Magic Quote) is a process that automatically escapes data that enters a PHP script. It is best to avoid escaping while encoding and escaping as needed at run time. What are magic quotes

When opened, all ' (single quotes), "(double quotes),/(backslashes), and NULL characters are automatically escaped with a backslash. This is exactly the same as the addslashes () function.

A total of three magic quotes instruction: MAGIC_QUOTES_GPC affects HTTP request data (Get,post and cookies). Cannot be changed at run time. In PHP, the default value is on. See GET_MAGIC_QUOTES_GPC (). Magic_quotes_runtime if opened, most of the data returned from external sources, including from the database and text files, will be escaped by backslashes. This option can be changed at run time, and the default value in PHP is off. See Set_magic_quotes_runtime () and Get_magic_quotes_runtime (). Magic_quotes_sybase if opened, the single quotation marks are used to escape instead of the backslash. This option will completely overwrite MAGIC_QUOTES_GPC. If you open two options at the same time, the single quote will be escaped as '. Double quotes, backslashes, and NULL characters are not escaped. How to get its value see Ini_get ().

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.