Home  >  Article  >  Backend Development  >  Solution to an incompatibility problem between PHP4 and PHP3_PHP Tutorial

Solution to an incompatibility problem between PHP4 and PHP3_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 16:04:48717browse

There are some incompatibilities between PHP4 and PHP3, but this is mainly due to the different settings in PHP.ini
in PHP4. These changes are mainly to improve the efficiency of PHP4.
Among the changes, the setting of track_vars usually makes the old PHP3 program no longer able to
run, because the value of track_vars is set to off in the extended settings of PHP4
In such old PHP3 program You cannot directly use GET, POST, and COOKIE to transfer
variables from the previous page.

I have a simple solution here. You don’t need to set track_vars to on.
But this is just a temporary solution. In the future, everyone will still use $HTTP_GET_VARS,
$HTTP_POST_VARS and $HTTP_COOKIE_VARS. It is better to read these variables.

The following is a simple program that you can add to each page that needs to read the variables of GET, POST, COOKIE
, and you can directly reference these variables.

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;
}
}
?>

Please give me your advice!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315872.htmlTechArticleThere are some incompatibilities between PHP4 and PHP3, but this is mainly due to some settings in PHP.ini in PHP4 Different places, these changes mainly improve the efficiency of PHP4. Among the changes, track_...
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