This article mainly introduces how to use PHP in CMS to determine whether the system has been installed. if you need it, you can refer to many common CMS systems that have installed programs for your convenience, before using the new downloaded system, the system will determine whether the CMS system has been installed. if it is installed, a prompt will be displayed, which does not require repeated installation. if it is not installed, the installation interface will be displayed, instruct the user to install CMS smoothly according to steps. how does the PHP-based CMS use code to implement this judgment mechanism? The following is an example code:
<? Phpdefine ("PHPOK_SET", true); define ("APP_ID", "www"); // define the root directory of the application! (This is not the ROOT directory of the system) This program limits the application directory to define ("ROOT", str_replace ("\\","/", dirname (_ FILE __)). "/"); // if the program goes out, change ROOT to the following line. // define ("ROOT ",". /"); // define the FRAMEWORK define (" FRAMEWORK ", ROOT. "framework/"); // check whether it has been installed. if it is not installed, go to the installation page. // We recommend that you remove this check after the installation is successful. If (! Is_file (ROOT. "data/install. lock ") // This file is generated after the system is installed. it is used to determine whether {header (" Location: install/index. php "); exit ;}?>
The above code is excerpted from PHPok and added comments to help readers understand it. it has some reference value for readers to develop their own CMS systems.