How to understand this sentence

Source: Internet
Author: User
How to understand this sentence if (ini_get ('Magic _ quotes_gpc '))

And the following section
If (ini_get ('Magic _ quotes_gpc ')){
Function stripslashesRecursive (array $ array ){
Foreach ($ array as $ k => $ v ){
If (is_string ($ v )){
$ Array [$ k] = stripslashes ($ v );
} Else if (is_array ($ v )){
$ Array [$ k] = stripslashesRecursive ($ v );
}
}
Return $ array;
}


Reply to discussion (solution)

(Ini_get ('Magic _ quotes_gpc ') // gets the value of a configuration option

The following function uses addslashes () to recursively escape strings in a multi-dimensional array, that is, to use the addslashes function to process all strings in the array.

1. for PHP magic_quotes_gpc = on, we can perform the addslashes () and stripslashes () operations on the string data of the input and output databases, and the data will be displayed normally.
If you have performed addslashes () processing on the input data at this time, you must use stripslashes () to remove unnecessary backslash when outputting the data.

2. PHP magic_quotes_gpc = off
You must use addslashes () to process the input data, but do not use stripslashes () to format the output. because addslashes () does not write the backslash together into the database, it only helps mysql to complete SQL statement execution.

Reference: http://developer.51cto.com/art/200911/165392.htm

(Ini_get ('Magic _ quotes_gpc ') // gets the value of a configuration option

The following function uses addslashes () to recursively escape strings in a multi-dimensional array, that is, to use the addslashes function to process all strings in the array.


I spoke quite well and hope to make persistent efforts

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.