开发的项目目录结构
入口文件为index.php所在位置应该为项目更目录下
编程代码为:
<?php
/**
* 入口文件
* 1.定义常量
* 2.加载函数库
* 3.启动框架
*/
/**
* 定义常量
*/
//当前框架所在的根目录
define('ZL',realpath('./'));
//定义核心文件所在的根目录
define('CORE',ZL.'/core');
//定义项目目录
define('APP',ZL.'/app');
define('MODULE','app');
define('DEBUG',true);
if(DEBUG)
{
ini_set('display_error','On');
}
else
{
ini_set('display_error','Off');
}
/**
* 加载函数
*/
include CORE.'/common/function.php';
include CORE.'/ZL.php';
/**
* 启动框架
*/
spl_autoload_register('\core\zl::load');//当加载的类不存在时加载zl下的load方法
\core\zl::run();
框架的核心文件都在./core目录下
基类文件为根目录下的zl.php文件
<?php
namespace core;
class zl
{
public static $classMap = array();
public $assign;
static public function run()
{
$route = new \core\lib\route();
$ctrlClass =