search
Homephp教程php手册PHP4与PHP3中一个不兼容问题的解决方法

PHP4与PHP3中有些不兼容的地方,但这主要是PHP4中的PHP.ini
中的设置有些不同的地方,这些改变主要是提高PHP4的效率。
其中的改变中,track_vars 的设置通常会是使旧的PHP3程序不能
再运行了,因为在PHP4的扩展设置中把track_vars 的值设为了off
这样旧的PHP3程序中就不能直接用GET,POST,COOKIE从上页传送过来
的变量了。

我这里有一个简单的解决的方法,不用把track_vars 的是设为on,
不过这只是一个权宜办法,以后大家还是用$HTTP_GET_VARS,  
$HTTP_POST_VARS and $HTTP_COOKIE_VARS读取这些变量比较好。

下面是一个简单的程序,大家可以加到每个需要读取GET,POST,COOKIE
的变量的页前,就可以直接引用这些变量了。

get.variable.inc.php


if(isset($HTTP_POST_VARS))
{
while ( list( $key, $val ) = each( $HTTP_POST_VARS ) )
{
$$key = $val;
}
}

if(isset($HTTP_GET_VARS))
{
while ( list( $key, $val ) = each( $HTTP_GET_VARS ) )
{
$$key = $val;
}
}


if(isset($HTTP_COOKIE_VARS))
{
while ( list( $key, $val ) = each( $HTTP_COOKIE_VARS ) )
{
$$key = $val;
}
}
?>  

请大家多多指教!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools