Home  >  Article  >  Backend Development  >  Example of how PHP in CMS determines whether the system has been installed_PHP tutorial

Example of how PHP in CMS determines whether the system has been installed_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:21:52663browse

CMS中PHP判断系统是否已经安装的方法示例

 这篇文章主要介绍了CMS中PHP判断系统是否已经安装的方法示例,需要的朋友可以参考下

 
 
 

当今很多常用的CMS系统都带有安装程序,为了用户的使用方便,新下载的系统在使用前,都会判断该CMS系统是否已经安装过,若安装了则就给出提示,不需要重复安装,若未安装则进入安装界面,指导用户按步骤顺利安装CMS,那么基于PHP环境的CMS到底是如何用代码来实现这种判断机制呢?下面通过一个实例代码加以说明:

<?php
define("PHPOK_SET",true);
define("APP_ID","www");
//定义应用的根目录!(这个不是系统的根目录)本程序将应用目录限制在独立应用下
define("ROOT",str_replace("\\","/",dirname(__FILE__))."/");
//如果程序出程,请将ROOT改为下面这一行
//define("ROOT","./");
//定义框架
define("FRAMEWORK",ROOT."framework/");
//检测是否已安装,如未安装跳转到安装页面
//建议您在安装成功后去除这个判断。
if(!is_file(ROOT."data/install.lock"))//这个文件是当系统安装完成后会生成,特用来判断是否安装过
{
 header("Location:install/index.php");
 exit;
}
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/852818.htmlTechArticleCMS中PHP判断系统是否已经安装的方法示例 这篇文章主要介绍了CMS中PHP判断系统是否已经安装的方法示例,需要的朋友可以参考下 当今很多常...
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