Home >Backend Development >PHP Tutorial >In-depth understanding of register_globals (with register_globals=off solution to the problem that the website cannot be opened)_PHP tutorial
In-depth understanding of register_globals
register_globals is forcibly restricted in dedecms
Since the register_globals setting controls the access scope of PHP variables, if it is turned on, it will cause unnecessary security issues, so it is forcibly turned off here. If The webmaster's space does not support it. You can use the following methods to modify it for your reference:
* If you are a standalone server user, you can modify php.ini in the php configuration file and set register_globals=On Change register_globals=Off, and then restart Apache.
* If you are a virtual host user, notify the space provider as much as possible to let them modify the configuration, or you can try ini_set('register_globals',0).
* Create a new .htaccess file in the website directory and add php_flag register_globals off. If you already have a .htaccess file, just add it in a new line at the end;
* If it doesn't work, the only last resort is to go directly to include/common.inc.php and delete the following code (not recommended).
//Enabling register_globals has many unsafe possibilities, so Force register_globals to be turned off if(ini_get('register_globals')){ exit('php.ini register_globals must be Off! '); } Starting from PHP4.2.0 version, the default value of register_globals setting option in php.ini becomes off. So, it's best to start programming in Off's style now!
The value of register_globals can be set to: On or Off. Let’s give a piece of code to describe their differences respectively.
Code: