Home  >  Article  >  Backend Development  >  A simple way to use post and get in php_PHP tutorial

A simple way to use post and get in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:38:51780browse

Recently I saw a clever method, the principle is
$var_a ='var_b';
$$var_a ='test';
then echo $var_b; is 'test'
so it can be handled like this

Copy code The code is as follows:

foreach(array('_COOKIE', '_POST', '_GET') as $ _request)
{
foreach($$_request as $_key => $_value)
{
$_key{0} != '_' && $$_key = addslashes($_value) ;
 }
}

Like test.php?name=name_in&pwd=pwd_in
you can directly use $name, $pwd
to quote the client to send data.
Note: The variables sent by the customer are filtered here using addslashes().

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321696.htmlTechArticleI recently saw a clever method, the principle is $var_a ='var_b'; $$var_a ='test' ; Then echo $var_b; is 'test', so the copied code can be processed as follows: foreach(array('_COOKI...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn