为什么不能获取PHP表单变量的?
时间:2007-02-17 来源:PHP爱好者
如果大家使用PHP4.2版本或者以上的请看这里。
设置register_globals = on 或者
加入以下代码:
// allow script to work with registerglobals off
if ( function_exists('ini_get') ) {
$onoff = ini_get('register_globals');
} else {
$onoff = get_cfg_var('register_globals');
}
if ($onoff != 1) {
@extract($HTTP_SERVER_VARS, EXTR_SKIP);
@extract($HTTP_COOKIE_VARS, EXTR_SKIP);
@extract($HTTP_POST_FILES, EXTR_SKIP);
@extract($HTTP_POST_VARS, EXTR_SKIP);
@extract($HTTP_GET_VARS, EXTR_SKIP);
@extract($HTTP_ENV_VARS, EXTR_SKIP);
}
详细参考这里:
http://www.21PHP.com/tutorial/tutorial.PHP?tid=21
相关讨论请看这里:
http://www.21PHP.com/forums/showthread.PHP?s=&postid=588#post588
http://www.21PHP.com/forums/showthread.PHP?s=&postid=400#post400
php爱好者站 http://www.phpfans.net 文章|教程|下载|源码|论坛.
设置register_globals = on 或者
加入以下代码:
// allow script to work with registerglobals off
if ( function_exists('ini_get') ) {
$onoff = ini_get('register_globals');
} else {
$onoff = get_cfg_var('register_globals');
}
if ($onoff != 1) {
@extract($HTTP_SERVER_VARS, EXTR_SKIP);
@extract($HTTP_COOKIE_VARS, EXTR_SKIP);
@extract($HTTP_POST_FILES, EXTR_SKIP);
@extract($HTTP_POST_VARS, EXTR_SKIP);
@extract($HTTP_GET_VARS, EXTR_SKIP);
@extract($HTTP_ENV_VARS, EXTR_SKIP);
}
详细参考这里:
http://www.21PHP.com/tutorial/tutorial.PHP?tid=21
相关讨论请看这里:
http://www.21PHP.com/forums/showthread.PHP?s=&postid=588#post588
http://www.21PHP.com/forums/showthread.PHP?s=&postid=400#post400
php爱好者站 http://www.phpfans.net 文章|教程|下载|源码|论坛.
相关阅读 更多 +