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 run, because the value of track_vars is set to off in the extended settings of PHP4
In this way, GET cannot be used directly in the old PHP3 program. POST, COOKIE are the variables sent 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 stopgap. In the future, it is better to use $HTTP_GET_VARS,
$HTTP_POST_VARS and $HTTP_COOKIE_VARS to read these variables.
The following is a simple program that you can add to each page that needs to read GET, POST, COOKIE
variables, 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 !
The above introduces the solution to the compatibility issue between PHP4 and PHP3, including the compatibility issue. I hope it will be helpful to friends who are interested in PHP tutorials.