Ejemplo n.º 1
0
<?php

include_once 'fn/fn.php';
include_once 'config.php';
FN::setConfig($config);
FN::initProject();
$route = FN::F('tools.route');
FN::map('route', $route);
//基本控制器
$route->route('main', array('rule' => '', 'class' => 'controller.manage.main|view', 'default' => array('action' => 'main')));
//视图/执行控制器
$route->route('manage', array('rule' => ':type:controller.:action.:op:param', 'class' => 'controller.$type.$controller|$op', 'extend' => array('controller' => array('(\\.\\w+)*', 'parseSlice', array(1)), 'op' => '(view|handle)', 'param' => array('(\\/\\w+)*', 'parseParam', array('/')))));
$route->run();
Ejemplo n.º 2
0
    if (empty($_SERVER['REQUEST_SCHEME'])) {
        $_SERVER['REQUEST_SCHEME'] = array_search($_SERVER['HTTP_HOST'], $default_port);
        if (empty($_SERVER['REQUEST_SCHEME'])) {
            $_SERVER['REQUEST_SCHEME'] = 'http';
        }
    }
    //当前访问的web路径
    define('FN_WEB_PATH', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . ($default_port[$_SERVER['REQUEST_SCHEME']] == $_SERVER['SERVER_PORT'] ? '' : ':' . $_SERVER['SERVER_PORT']) . FNbase::getBaseUri());
} else {
    //当前为控制器操作
    define('FN_CONSOLE', true);
}
//入口文件所在的系统路径
define('FN_SYSTEM_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . '/');
//用于满足框架自身工具类的正常使用
FN::setConfig(array('autoCode' => 'freedomnature', 'charset' => 'UTF-8'), 'global');
//自动加载类
if (false === spl_autoload_functions() && function_exists('__autoload')) {
    spl_autoload_registe('__autoload', false);
}
spl_autoload_register(array('FN', 'loadClass'));
class FN
{
    private $config = array();
    //全局配置设定,按每个主项目进行划分
    private static $_FileSpace = array();
    private static $_InitProject = false;
    private static $_Instance = null;
    private static $_NowCloud = false;
    private static $_Frame = null;
    //存储自身映射关系,用作全局对象管理