当前位置: 首页>>代码示例>>PHP>>正文


PHP route类代码示例

本文整理汇总了PHP中route的典型用法代码示例。如果您正苦于以下问题:PHP route类的具体用法?PHP route怎么用?PHP route使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了route类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAllRoutes

 /**
  * get all routes
  * get the URLs, the variables, the modules and the actions of all routes, use the "/applications/config/routes.xml" file.
  * @param string current url (optionnal)
  * @return array list of routes object
  */
 public function getAllRoutes($currentUrl = null)
 {
     //get content of the file.
     $xml = new \DOMDocument();
     $xml->load(__DIR__ . '/../applications/config/routes.xml');
     $file = $xml->getElementsByTagName('route');
     //parse the content.
     $varsNames = array();
     $varsValues = array();
     $varsList = array();
     foreach ($file as $line) {
         //create the route.
         $varsNames = explode(',', $line->getAttribute('vars'));
         //get the name of all variables
         $route = new route($line->getAttribute('url'), $line->getAttribute('module'), $line->getAttribute('action'), $line->getAttribute('name'), $varsNames);
         //get variables.
         if ($varsValues = $route->match($currentUrl)) {
             array_shift($varsValues);
             // the first result contain the full captured string (cf. pregmatch manual).
             foreach ($varsValues as $key => $match) {
                 $varsList[$varsNames[$key]] = $match;
             }
             $route->setVars($varsList);
         }
         //add the route to the router.
         $this->addRoute($route);
     }
     //return all routes.
     return $this->routes;
 }
开发者ID:ThomasSchweizer,项目名称:agoraexmachina,代码行数:36,代码来源:router.class.php

示例2: get_options_fincas

 function get_options_fincas()
 {
     $con = new con();
     $msg = new messages();
     $rt = new route();
     $con->connect();
     //consultamos fincas desde la matriz ica
     if (isset($_SESSION["ses_id"])) {
         $qry = 'SELECT DISTINCT codfinca, municipio, depto FROM tbl_matriz_ica ORDER BY codfinca ASC';
         $res = mysql_query($qry);
         $item = " ";
         $script = "<script>\$(document).ready(function(){";
         while ($row_res = mysql_fetch_assoc($res)) {
             $item .= '
           <option value="' . $row_res["codfinca"] . '">' . $row_res["codfinca"] . ' (' . $row_res["municipio"] . ' - ' . $row_res["depto"] . ')</option>
     ';
             $script .= '';
         }
         $script .= '});</script>';
     } else {
         $rt->routing($rt->path("login"));
     }
     $html = '
     <select class="form-control valued" id="cod">
       ' . $item . '
     </select>
 ';
     $con->disconnect();
     return $script . $html;
 }
开发者ID:alchemixt99,项目名称:STL,代码行数:30,代码来源:supervisores.php

示例3: __construct

 function __construct(route $route)
 {
     $this->config = $route->getConfig();
     unset($route);
     $this->getCacheKey();
     $this->getCache();
 }
开发者ID:laiello,项目名称:ffphp,代码行数:7,代码来源:cacheSys.php

示例4: go

 public function go()
 {
     $route = new route();
     $path = $route->getRoute();
     $this->controll = $path['controll'] . 'Ctrl';
     $this->action = $path['action'];
     //加载控制器和方法
     include APP . '/controll/' . $this->controll . '.php';
     $c = new $this->controll();
     $c->{$this->action}();
 }
开发者ID:kphcdr,项目名称:PPAPI,代码行数:11,代码来源:ppphp.php

示例5: start

 static function start()
 {
     $routes = explode('/', $_GET['router']);
     if ($routes[0]) {
         $controller_name = "Controller" . $routes[0];
     } elseif ($routes[0] == "") {
         $controller_name = "Controllerindex";
     }
     if ($routes[1]) {
         $action_name = $routes[1];
     } else {
         $action_name = "index";
     }
     $model_name = "Model" . $routes[0];
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/apps/controler/" . mb_strtolower($controller_name) . ".php")) {
         include_once $_SERVER['DOCUMENT_ROOT'] . "/apps/controler/" . mb_strtolower($controller_name) . ".php";
         $controller = new $controller_name();
     } else {
         $controller = new Controler();
     }
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/apps/model/" . mb_strtolower($model_name) . ".php")) {
         include_once $_SERVER['DOCUMENT_ROOT'] . "/apps/model/" . mb_strtolower($model_name) . ".php";
     }
     if (method_exists($controller, $action_name)) {
         $controller->{$action_name}();
     } else {
         echo route::ErrorPage404();
     }
 }
开发者ID:edward1995,项目名称:micro-framework,代码行数:29,代码来源:route.php

示例6: get_fincas_list

 function get_fincas_list()
 {
     $con = new con();
     $msg = new messages();
     $rt = new route();
     $con->connect();
     //consultamos fincas desde la tabla de fincas
     if (isset($_SESSION["ses_id"])) {
         $qry = 'SELECT * FROM tbl_fincas WHERE fi_estado=1 ORDER BY fi_id ASC';
         $res = mysql_query($qry);
         $item = " ";
         $script = "<script>\$(document).ready(function(){";
         while ($row_res = mysql_fetch_assoc($res)) {
             $item .= '
           <option value="' . $row_res["fi_id"] . '">' . $row_res["fi_codigo"] . '</option>
     ';
             $script .= '';
         }
         $script .= '});</script>';
     } else {
         $rt->routing($rt->path("login"));
     }
     $html = '
     <select class="form-control valued" id="cod">
       <option>Seleccione</option>
       ' . $item . '
     </select>
 ';
     $con->disconnect();
     return $script . $html;
 }
开发者ID:alchemixt99,项目名称:STL,代码行数:31,代码来源:inventarios.php

示例7: getFacadeAccessor

 protected static function getFacadeAccessor()
 {
     if (!static::$__router) {
         static::$__router = kernel::single('base_routing_router', request::instance());
         route::boot();
     }
     return static::$__router;
 }
开发者ID:453111208,项目名称:bbc,代码行数:8,代码来源:route.php

示例8: getFacadeAccessor

 protected static function getFacadeAccessor()
 {
     if (!static::$__url) {
         $routes = route::getRoutes();
         static::$__url = new base_routing_urlgenerator($routes, request::instance());
     }
     return static::$__url;
 }
开发者ID:453111208,项目名称:bbc,代码行数:8,代码来源:url.php

示例9: __construct

 public function __construct($param = array())
 {
     parent::__construct($param);
     if (count($this->param->part)) {
         foreach ($this->param->part as $k => $v) {
             $class = 'route_' . $v->type;
             $this->param->part->{$k} = class_exists($class) ? new $class($v->param) : new data($v->param);
         }
     }
 }
开发者ID:s-kalaus,项目名称:ekernel,代码行数:10,代码来源:chain.php

示例10: get_reports

 function get_reports()
 {
     $con = new con();
     $msg = new messages();
     $rt = new route();
     $con->connect();
     //consultamos fincas
     if (isset($_SESSION["ses_id"])) {
         $qry = 'SELECT * FROM tbl_reporte_consecutivo ORDER BY rp_consecutivo DESC ';
         $res = mysql_query($qry);
         $item = " ";
         $script = "<script>\$(document).ready(function(){";
         while ($row_res = mysql_fetch_assoc($res)) {
             $item .= '
           <tr>
             <td>' . $row_res["rp_timestamp"] . '</td>
             <td>' . $row_res["rp_consecutivo"] . '</td>
             <td>' . $row_res["rp_causa"] . '</td>
           </tr>
     ';
             $script .= '';
         }
         $script .= '});</script>';
     } else {
         $rt->routing($rt->path("login"));
     }
     $html = '
       <table class="table table-striped table-hover ">
         <thead>
           <tr>
             <th>Fecha reporte</th>
             <th>Consecutivo</th>
             <th>Causa</th>
           </tr>
         </thead>
         <tbody>
           ' . $item . '
         </tbody>
       </table> 
 ';
     $con->disconnect();
     return $script . $html;
 }
开发者ID:alchemixt99,项目名称:STL,代码行数:43,代码来源:reportar.php

示例11: theme_widget_items_category

/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
function theme_widget_items_category(&$setting)
{
    // 判断是否首页
    if (route::currentRouteName() == 'topc') {
        $returnData['isindex'] = true;
    }
    if (false && base_kvstore::instance('topc_category')->fetch('category_ex_vertical_widget.data', $cat_list)) {
        return $cat_list;
    }
    $returnData['data'] = app::get('topc')->rpcCall('category.cat.get.list', array('fields' => 'cat_id,cat_name'));
    return $returnData;
}
开发者ID:453111208,项目名称:bbc,代码行数:18,代码来源:theme_widget_items_category.php

示例12: theme_widget_index_category

/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
function theme_widget_index_category(&$setting)
{
    // 判断是否首页
    $A = route::currentRouteName();
    //var_dump($_SERVER);
    if (route::currentRouteName() == 'topc' || $_SERVER["ORIG_PATH_INFO"] == "/index.php/trading" || $_SERVER["DOCUMENT_URI"] == "/index.php/trading") {
        $returnData['isindex'] = true;
    }
    if (false && base_kvstore::instance('topc_category')->fetch('category_ex_vertical_widget.data', $cat_list)) {
        return $cat_list;
    }
    $returnData['data'] = app::get('topc')->rpcCall('category.cat.get.list', array('fields' => 'cat_id,cat_name'));
    //var_dump($returnData);
    return $returnData;
}
开发者ID:453111208,项目名称:bbc,代码行数:21,代码来源:theme_widget_index_category.php

示例13: handle

 public function handle($request, Clousure $next)
 {
     $routeAs = route::currentRouteName();
     $currentPermission = shopAuth::getSellerPermission();
     //$currentPermission = false 表示为店主不用判断权限
     //获取当前用户的路由权限
     if ($currentPermission && !in_array($routeAs, $currentPermission)) {
         if (request::ajax()) {
             return response::json(array('error' => true, 'message' => '无操作权限'));
         } else {
             return redirect::action('topshop_ctl_index@nopermission');
         }
     }
     return $next($request);
 }
开发者ID:453111208,项目名称:bbc,代码行数:15,代码来源:permission.php

示例14: match_route

 /**
  * match the requested route with one of the routes added to the routes array on the main maverick class
  * @param string $protocol the protocol specified in the routes, either post, get, or any
  * @param string $route the route string
  * @param string $action the action to take, usually in the form of controller->method
  * @param array $args an array of matched parameters to pass to the routing controller class
  * @return boolean
  */
 private static function match_route($protocol, $route, $action, $args)
 {
     $maverick = \maverick\maverick::getInstance();
     // return if a route has already been matched
     if (isset($maverick->route)) {
         return false;
     }
     // return if the protocols don't match
     if (strtolower($_SERVER['REQUEST_METHOD']) == $protocol || $protocol == 'any') {
         preg_match("~^{$route}\$~", $maverick->requested_route_string, $matches);
         // route match - assign the information back to the main maverick object
         if (!empty($matches)) {
             $maverick->controller = route::get_full_action($action, $args, $matches);
         }
     } else {
         return false;
     }
 }
开发者ID:AshleyJSheridan,项目名称:tweed,代码行数:26,代码来源:route.php

示例15: init_route

 /**
  * 初始化路由
  *
  * @since  1.0.1
  * @notice 主要的路径下,尽可能囊括更多的选择,诸如/join/?123
  */
 private function init_route()
 {
     route::register('/', 'index');
     route::register('/index.php', 'index');
     route::register('/\\?.*', 'index', true);
     route::register('/index.php\\?.*', 'index', true);
     route::register('/join', 'join');
     route::register('/join\\?.*', 'join', true);
     route::register('/join/\\?.*', 'join', true);
     route::register('/baoming', 'join');
     route::register('/baoming\\?.*', 'join', true);
     route::register('/baoming/\\?.*', 'join', true);
     route::register('/about', 'about');
     route::register('/about\\?.*', 'about', true);
     route::register('/about/\\?.*', 'about', true);
     route::register('/links', 'links');
     route::register('/links\\?.*', 'links', true);
     route::register('/links/\\?.*', 'links', true);
     route::register('/contact', 'contact');
     route::register('/contact\\?.*', 'contact', true);
     route::register('/contact/\\?.*', 'contact', true);
     route::register('/bbs', 'bbs');
     route::register('/bbs\\?.*', 'bbs', true);
     route::register('/bbs/\\?.*', 'bbs', true);
     route::register('/dispbbs.asp', 'bbs');
     route::register('/dispbbs.asp\\?.*', 'bbs', true);
     route::register('/index.asp', 'bbs');
     route::register('/index.asp\\?.*', 'bbs', true);
     route::register('/forum', 'forum');
     route::register('/forum\\?.*', 'forum', true);
     route::register('/forum/\\?.*', 'forum', true);
     route::register('/thread', 'forum');
     route::register('/thread\\?.*', 'forum', true);
     route::register('/thread/\\?.*', 'forum', true);
     route::register('/home.php', 'forum');
     route::register('/home.php\\?.*', 'forum', true);
     route::register('/member.php', 'forum');
     route::register('/member.php\\?.*', 'forum', true);
     route::register('/hi-cat', 'hi_cat');
     route::register('/hi-cat\\?.*', 'hi_cat', true);
     route::register('.*', 'page404', true);
     new Route();
 }
开发者ID:venmos,项目名称:go9999.com,代码行数:49,代码来源:app.class.php


注:本文中的route类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。