How to use $_GPC[ ] in PHP?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-16 13:04:22
0
1
547

How to use $_GPC[ ] in PHP?
Baidu didn’t understand it either.

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(1)
滿天的星座

php escape gpc

In PHP, the get_magic_quotes_gpc() function is a get_magic_quotes_gpc()函数是内置的函数,这个函数的作用就是得到php.ini设置中magic_quotes_gpcbuilt-in function

. The function of this function is to get the value of the

option in the php.ini setting. magic_quotes_gpc

Then let’s talk about it first

Options:magic_quotes_gpc=On
PHP解析器就会自动为post、get、cookie If magic_quotes_gpc=On

PHP parser will automatically add the escape character ""

to the data coming from post, get, cookie to ensure that these data will not Cause fatal errors in programs, especially database statements, due to contamination caused by special characters (characters considered to be PHP characters). After insertion, the original data before escaping is displayed in the database, so there is no need to escape it when taken out.

In the case of magic_quotes_gpc=On, if the input data contains characters such as

single quotation mark ('), double quotation mark ("), backslash () and NUL (NULL character), backslashes will be added. These conversions Definition is required. If this option is off, then we must call the addslashes function to add escaping to the string.

It is precisely because of the contradiction that this option must be On, but it also allows users to configure it, this option has been deleted in PHP6, and all programming needs to be performed under magic_quotes_gpc=Off. In such an environment, if the user's data is not escaped, the consequences are not just program errors. The same will cause the risk of database injection attacks. So from now on, everyone should no longer rely on this setting being On, lest one day your server needs to be updated to PHP6 and your program will not work properly. 🎜
当magic_quotes_gpc=On的时候,函数get_magic_quotes_gpc()就会返回1

当magic_quotes_gpc=Off的时候,函数get_magic_quotes_gpc()就会返回0
🎜So it can be seen that the function of this get_magic_quotes_gpc() function is to get the value of the environment variable magic_quotes_gpc. Since the magic_quotes_gpc option has been deleted in PHP6, I think this function no longer exists in PHP6🎜
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template