Home > Backend Development > PHP Tutorial > 哪位大咖知道这段代码是做什么的?

哪位大咖知道这段代码是做什么的?

WBOY
Release: 2016-06-23 14:02:41
Original
878 people have browsed it

哪位大咖知道这段代码是做什么的?

        $superglobal = array(				'GLOBALS' => 1,				'_GET' => 1,				'_POST' => 1,						'_COOKIE' => 1,				'_SERVER' => 1,				 		'_FILES' => 1,		);		foreach($GLOBALS as $k=>$v) {			if(!isset($superglobal[$k])) {				$GLOBALS[$k] = null; unset($GLOBALS[$k]);			}		}
Copy after login


回复讨论(解决方案)

superglobal在这里当了一个过滤器

过滤掉global里面的一些变量,

执行后GLOBALS只保留GLOBALS,_GET_POST_COOKEI,_SERVER _FILES

删除全局变量,不包括在 $superglobal 中指定的

大咖们正解,结贴。

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template