Example #1
0
 * 核心路由

 * Created by PhpStorm.
 * 作者:NumberWolf
 * Email:porschegt23@foxmail.com
 * APACHE 2.0 LICENSE
 * Copyright [2016] [Chang Yanlong]

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

 **************************************************************************/
$app_router = \RSystem\system::load_config('config');
Roller($app_router);
function Roller($app_router)
{
    $route_arr = explode("/", preg_replace(array("/(index\\.php\\/)/ism", "/(\\?\\/)/ism", "/(" . PROJECT_NAME . "\\/)/ism"), '', $_SERVER['REQUEST_URI']));
    $route_arr = array_values(array_diff($route_arr, array(null, '', 'null', ' ')));
    $route_home = count($route_arr) > 0 ? $route_arr[0] : $app_router['Home'];
    $route_control = count($route_arr) > 1 ? $route_arr[1] : $app_router['Cont'];
    $route_method = count($route_arr) > 2 ? $route_arr[2] : $app_router['Meth'];
    //$route_method = preg_match('/^[a-zA-Z0-9]/' , $_GET['Meth']) ? $_GET['Meth'] : $app_router['Meth'];
    $module = CONT_PATH . '/' . $route_home;
    $controller = $module . '/' . $route_control . '.php';
    if (!is_dir($module)) {
        die('<h1>RollerPHP: \'' . $route_home . '\' 找不到</h1>');
    }
    if (!file_exists($controller)) {