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


PHP Routes::getRoutes方法代码示例

本文整理汇总了PHP中Routes::getRoutes方法的典型用法代码示例。如果您正苦于以下问题:PHP Routes::getRoutes方法的具体用法?PHP Routes::getRoutes怎么用?PHP Routes::getRoutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Routes的用法示例。


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

示例1: executeCommand

 /**
  * Execute la commande d'affichage des routes de l'application
  * @return string
  */
 public function executeCommand()
 {
     // récupération des routes de l'application
     require_once ROOT_DIR . '/app/routes.php';
     $cadrecell = '+' . str_repeat("-", $this->lencell) . '+' . str_repeat("-", $this->lencellmethod) . '+' . str_repeat("-", $this->lencellalias) . '+' . str_repeat("-", $this->lencell) . '+' . "\n";
     echo $cadrecell;
     echo '| URL ' . str_repeat(" ", $this->lencell - 5) . '| METHOD ' . str_repeat(" ", $this->lencellmethod - 8) . '| ALIAS ' . str_repeat(" ", $this->lencellalias - 7) . '| CALL ' . str_repeat(" ", $this->lencell - 6) . '|' . "\n";
     echo $cadrecell;
     foreach (\Routes::getRoutes() as $method => $routes) {
         foreach ($routes as $route) {
             echo '| ' . $route->getPath() . str_repeat(' ', $this->lencell - strlen($route->getPath()) - 1);
             echo '| ' . $method . str_repeat(' ', $this->lencellmethod - strlen($method) - 1);
             echo '| ' . $route->getAlias() . str_repeat(' ', $this->lencellalias - strlen($route->getAlias()) - 1);
             echo '| ' . $route->getCallable() . str_repeat(' ', $this->lencell - strlen($route->getCallable()) - 1) . '|' . "\n";
         }
     }
     echo $cadrecell;
     exit;
 }
开发者ID:alaindessi,项目名称:adweb,代码行数:23,代码来源:Routes.php

示例2: switch

switch ($_SERVER['REQUEST_METHOD']) {
    case 'POST':
        $request = 'post:' . $request;
        break;
    case 'PUT':
        $request = 'put:' . $request;
        parse_str(file_get_contents('php://input'), $_REQUEST);
        break;
    case 'DELETE':
        $request = 'delete:' . $request;
        break;
    default:
        $request = 'get:' . $request;
        break;
}
try {
    require '../../routes.php';
    $routes = Routes::getRoutes();
    foreach ($routes as $route) {
        if (preg_match('/^' . $route[0] . '$/', $request, $matches)) {
            $result = call_user_func($route[1], $matches);
            break;
        }
    }
    header('Content-Type: application/json');
    echo json_encode($result);
} catch (Exception $e) {
    header('HTTP/1.1 403 Forbidden');
    header('Content-Type: application/json');
    echo json_encode(['message' => $e->getMessage()]);
}
开发者ID:acidron,项目名称:kpi_bookshelf,代码行数:31,代码来源:index.php

示例3: str_replace

<?php

//make use of absolute path when service launth.
require_once "routes.php";
require_once "DjentController.php";
$url = str_replace("http://got-djent.com/", "", $_GET["url"]);
$routes = Routes::getRoutes(str_replace("http://got-djent.com/", "", $_GET["url"]));
$routes["controller"]::$routes["action"]($routes["id"]);
开发者ID:atsushi130,项目名称:got-djent-api,代码行数:8,代码来源:djent.php

示例4: getRoutes

/**
 * Fonction de test ( development )
 * @return [type] [description]
 */
function getRoutes()
{
    require __DIR__ . '/tests/routes.php';
    $test = Routes::getRoutes();
    var_dump($test);
}
开发者ID:alaindessi,项目名称:adweb,代码行数:10,代码来源:app.functions.php

示例5: loadRoutes

function loadRoutes()
{
    return Routes::getRoutes();
}
开发者ID:medo,项目名称:elmasla7a,代码行数:4,代码来源:index.php


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