Home >php教程 >php手册 >php 获取全局变量的代码

php 获取全局变量的代码

WBOY
WBOYOriginal
2016-06-06 20:36:381339browse

php 获取全局变量的代码,需要的朋友可以参考下。

代码如下:
function cleanGlobal($global_array, $arg, $specialchars = true, $default = null) {
if(key_exists($arg, $global_array) && $global_array[$arg] != null && $global_array[$arg] != "") {
if($specialchars) {
return htmlspecialchars($global_array[$arg]);
} else {
return $global_array[$arg];
}
} else {
return $default;
}
}
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