Example #1
0
 /**
  * 入口方法
  * @param array $config 项目简单配置
  */
 public static function run($config)
 {
     //初始化设置
     self::init();
     //定义系统常量
     self::define($config);
     //包含框架中的函数库文件
     require FIREZP_PATH . 'common' . DIRECTORY_SEPARATOR . 'function.inc.php';
     //加载所有配置
     if (file_exists(APP_PATH . 'conf' . DIRECTORY_SEPARATOR . 'confing.inc.php')) {
         $appConfig = (require APP_PATH . 'conf' . DIRECTORY_SEPARATOR . 'confing.inc.php');
         $sysConfig = array('page' => 8);
         //系统配置
         $config = array_merge($sysConfig, $appConfig, $config);
     }
     C($config);
     //系统url
     self::initUrl();
     //设置自动加载类
     spl_autoload_register(array('self', 'autoload'));
     //设置包含目录(类所在的全部目录),  PATH_SEPARATOR 分隔符号 Linux(:) Windows(;)
     $include_path = get_include_path();
     //原基目录
     $include_path .= PATH_SEPARATOR . FIREZP_PATH . "base/";
     //框架中基类所在的目录
     set_include_path($include_path);
     //调试开始
     debug::debugbegin();
     //项目结构化
     appStruct::make();
     //url解析
     parseUrl::run();
     //安全过滤
     self::safe();
     //开始session
     session_start();
     //实例化控制器
     $controllerFile = APP_PATH . "controller" . DIRECTORY_SEPARATOR . strtolower($_GET["c"]) . "Controller.php";
     define('CONTROLLER', $_GET["c"]);
     define('ACTION', $_GET["a"]);
     if (file_exists($controllerFile)) {
         $controller = $_GET["c"] . "Controller";
         $controllerObj = new $controller();
         $action = $_GET["a"] . "Action";
         if (method_exists($controllerObj, $action)) {
             $controllerObj->{$action}();
         } else {
             debug::add($action . '方法不存在');
         }
     } else {
         debug::add('控制器不存在');
     }
     //输出调试信息
     if (DEBUG == 1) {
         debug::debugend();
         debug::show();
     }
 }
<?php

/**
 * Copyright: ajaxmasters.com
 * Original Authors: ajaxmasters.com
 */
include 'core/main.class.php';
$main = new Main();
$users = new Users();
//get pars except for page
$pars = parseUrl::get_pars($_GET['pars']);
//get page name and store it in a variable
$pagename = parseUrl::get_page(Security::secureString($_GET['pars']));
$filename = $main->modulesUrl($pagename);
//include the header of every module
$controller = $main->controllerUrl($pagename);
if (is_file($controller)) {
    include_once $controller;
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <?php 
include_once CORE_DIR . "meta_tags.php";
?>
        <link rel="stylesheet" href="<?php 
echo HTTP_CORE_BASE;
?>