function logVars($varList, $excludeList = null) { if ($excludeList == null){ $excludeList = array('GLOBALS', '_FILES', '_COOKIE', '_POST', '_GET', '_SERVER', '_REQUEST', '_G', 'discuz'); //排除查看的变量名 } $list = array(); foreach ($varList as $key => $value) { if (!in_array($key, $excludeList)){ $list[$key] = $value; } } echo '<pre>'; print_r($list); echo '</pre>'; } logVars(get_defined_vars()); //变量 logVars(get_defined_constants()); //常量 |
GMT+8, 2024-5-20 19:32 , Processed in 0.071094 second(s), 10 queries , Xcache On.
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.