Example of how PHP checks whether the system has been installed in CMS
This article describes how to use PHP in CMS to determine whether the system has been installed. For more information, see
Many common CMS systems today have installation programs. For the convenience of users, the new downloaded system will determine whether the CMS system has been installed before use, if the installation is complete, a prompt is displayed, which does not require repeated installation. If the installation is not complete, the installation interface is displayed to instruct the user to install the CMS smoothly According to the steps, so 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 ;}?>