Special characters submitted by "PHP" will be automatically escaped

Source: Internet
Author: User
When working with MySQL and get, post data, it is often necessary to escape the quotation marks of the data. There are three settings in PHP that can be implemented automatically for ' (single quotes), "(double quotes), \ \ (backslash), and NULL character transfer. PHP is called Magic quotes, these three settings are MAGIC_QUOTES_GPC affect the HTTP request data (Get,post and COOKIE) respectively. Cannot be changed at run time. The default value in PHP is on. Magic_quotes_runtime if open, most of the functions that get data from external sources and return the data, including from the database and text files, are escaped by backslashes. This option can be changed at run time, and the default value in PHP is off. Magic_quotes_sybase if turned on, single quotes are escaped using single quotes instead of backslashes. This option will completely overwrite the MAGIC_QUOTES_GPC. If you open two options at the same time, the single quotes will be escaped as ". Double quotes, backslashes, and NULL characters are not escaped. Although it is convenient to automatically escape the special symbols, this can reduce the efficiency of the program and cause the program portability to become cumbersome. Without knowing the server INI setting, you also need to call GET_MAGIC_QUOTES_GPC (), Get_magic_quotes_runtime (), or ini_get () to detect the status.

Special characters submitted by "PHP" will be automatically escaped

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.