How to use $_GPC[ ] in PHP?
Baidu didn’t understand it either.
滿天的星座2017-05-16 13:06:22
php escape gpc
In PHP, the get_magic_quotes_gpc()
function is a get_magic_quotes_gpc()
函数是内置的函数,这个函数的作用就是得到php.ini
设置中magic_quotes_gpc
built-in function
option in the php.ini
setting. magic_quotes_gpc
Options:magic_quotes_gpc=On
PHP解析器就会自动为post、get、cookie
If magic_quotes_gpc=On
PHP parser will automatically add the escape character ""
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🎜