/** * 自動判斷PHP版本,並將所有環境變數轉為全域變數 * * @author Avenger * @version * @version * @version */ 函數 pmyoutput(&$a) { if (is_array($a)) { } else { $a = stripslashes($a); $a = str_replace('"', '"', $a); } } 函數 pmyinput(&$a) { if (is_array($a)) { } else { $a =addslashes($a); } } /* if (phpversion() isset($HTTP_SESSION_VARS_SESSION_VARS_SESSION? $GLOBALS['_SESSION'] = &$HTTP_SESSION_VARS:''; isset($HTTP_SERVER_VARS) ? $GLOBALS['_SERVER'] = &$HTTP_SERVER_VARS:''; isset($HTTP_ENV_VARS) ? $GLOBALS['_ENV'] = &$HTTP_ENV_VARS:''; isset($HTTP_FILES_VARS) ? $GLOBALS['_FILES'] = &$HTTP_FILES_VARS:''; if (get_magic_quotes_gpc() == 1) { isset($HTTP_GET_VARS) ? $GLOBALS['_GET'] = &$HTTP_GET_VARS:''; isset($HTTP_POST_VARS) ? $GLOBALS['_POST'] = &$HTTP_POST_VARS:''; isset($HTTP_COOKIE_VARS) ? $GLOBALS['_COOKIE'] = &$HTTP_COOKIE_VARS:''; } 其他 { isset($HTTP_GET_VARS) ? pmyinput($HTTP_GET_VARS) : ''; isset($HTTP_POST_VARS) ? pmyinput($HTTP_POST_VARS) : ''; isset($HTTP_COOKIE_VARS) ? pmyinput($HTTP_COOKIE_VARS) : ''; $GLOBALS['_GET'] = &$HTTP_GET_VARS; $GLOBALS['_POST'] = &$HTTP_POST_VARS; $GLOBALS['_COOKIE'] = &$HTTP_COOKIE_VARS; } $GLOBALS['_REQUEST'] = array_merge($_GET, $_POST, $_COOKIE); } else { if (get_magic_quotes_gpc() != 1) { isset($_GE pmyinput($_GET) : ''; isset($_POST) ? pmyinput($_POST) : ''; isset($_COOKIE) ? pmyinput($_COOKIE) : ''; isset($_REQUEST) ? pmyinput($_REQUEST) : ''; } } */ ? 以上就介紹了globalphp,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。