/** * 项目管理统一进入接口 * * 此控制器需要路由设置,路由会直接将project和uri传入到控制器的$this->project和$this->uri里 * * 路由如下: 'project' => array( # 匹配的URL 'uri' => '/p/<project>(/<uri>)', # 匹配正则 'preg' => array( 'project' => '[a-zA-Z0-9_]+', *', ), # 默认值 'defalut' => array( 'controller' => 'Admin_P', 'action' => 'default', ), ), */ public function action_default() { if (!$this->project) { Core::show_404('请指定项目'); } # 切换到指定项目 Core::set_project($this->project); # 执行项目的后台 HttpIO::execute(ltrim($this->uri, '/')); }
/** * 项目管理统一进入接口 * * 此控制器需要路由设置,路由会直接将project和uri传入到控制器的$this->project和$this->uri里 * * 路由如下: 'project' => array( # 匹配的URL 'uri' => '/p/<project>(/<uri>)', # 匹配正则 'preg' => array( 'project' => '[a-zA-Z0-9_]+', *', ), # 默认值 'defalut' => array( 'controller' => 'Admin__P', 'action' => 'default', ), ), */ public function action_default() { if (!$this->project) { Core::show_404('请指定项目'); } define('IN_ADMIN', true); # 切换到指定项目 Core::set_project($this->project); # 执行项目的后台 HttpIO::execute(ltrim($this->uri, '/'), true, true, false, 'admin'); }
/** * 执行新控制 * * 若采用非内部调用,则会等同于浏览器的URI执行,请注意防止陷入死循环 * * @param string $uri 新的uri * @param boolean $print 是否直接输出 * @param boolean $use_route 是否在路由中寻找,默认:是 * @param boolean $is_internal 是否内部调用,默认:是 * @return string 返回新控制器执行的html */ public static function execute($uri, $print = true, $use_route = true, $is_internal = true) { return HttpIO::execute($uri, $print, $use_route, $is_internal); }
/** * 系统执行 * 本方法只运行一次 */ public static function run() { static $run = null; if (true === $run) { return; } $run = true; # 加入debug信息 Core::debug()->log(Core::$path_info, 'PathInfo'); Core::$arguments = explode('/', trim(Core::$path_info, '/ ')); # 执行 $output = HttpIO::execute(Core::$path_info, false); if (false === $output) { # 抛出404错误 Core::show_404(); exit; } Core::$output = $output; }