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


PHP Route::dispatch方法代码示例

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


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

示例1: bootstrap

 public function bootstrap()
 {
     $this->constant();
     //加载服务配置项
     $servers = (require __DIR__ . '/service.php');
     $config = (require ROOT_PATH . '/system/config/service.php');
     $servers['providers'] = array_merge($config['providers'], $servers['providers']);
     $servers['facades'] = array_merge($config['facades'], $servers['facades']);
     $this->servers = $servers;
     //自动加载系统服务
     Loader::register([$this, 'autoload']);
     //绑定核心服务提供者
     $this->bindServiceProvider();
     //添加初始实例
     $this->instance('App', $this);
     //设置外观类APP属性
     ServiceFacade::setFacadeApplication($this);
     //启动服务
     $this->boot();
     //定义错误/异常处理
     Error::bootstrap();
     //命令行模式
     IS_CLI and die(Cli::bootstrap());
     //导入类库别名
     Loader::addMap(c('app.alias'));
     //自动加载文件
     Loader::autoloadFile();
     //开启会话
     Session::start();
     //执行全局中间件
     Middleware::globals();
     //解析路由
     Route::dispatch();
 }
开发者ID:houdunwang,项目名称:hdphp,代码行数:34,代码来源:App.php

示例2: parseRoute

 /**
  * 解析路由
  *
  * @return bool
  */
 private function parseRoute()
 {
     //导入路由
     require 'System/routes.php';
     //分析处理
     return Route::dispatch();
 }
开发者ID:ChenHuaPHP,项目名称:ZOLshop,代码行数:12,代码来源:Kernel.php

示例3: analyse

 public function analyse()
 {
     $query = Input::get('q');
     $analysisData = new stdClass();
     $analysisData->keyword = $query;
     $analysisData->posts = array();
     $analysisData->tools = array('all');
     $postsRetrievers = array(new FacebookPostsRetriever(), new TwitterPostsRetriever());
     foreach ($postsRetrievers as $postsRetriever) {
         $posts = $postsRetriever->retrieve($query, null);
         $analysisData->posts = array_merge($analysisData->posts, $posts);
     }
     $analysisDataJSON = json_encode($analysisData);
     //        $response = Unirest::post("http://service/analyzer",
     //			array( "Accept" => "application/json" ),
     //			array('query' => $analysisDataJSON)
     //        );
     $request = Request::create('/service/analyzer', 'POST', array('query' => $analysisDataJSON));
     Request::replace($request->input());
     $response = Route::dispatch($request)->getContent();
     //		$analysisResult = json_decode($response->raw_body);
     $analysisResult = json_decode($response);
     foreach ($analysisResult->posts as $post) {
         foreach ($analysisData->posts as $postData) {
             if ($postData['id'] == $post->id) {
                 $post->data = $postData;
                 break;
             }
         }
     }
     return View::make('AnalysisResult')->with('analysisResult', $analysisResult);
 }
开发者ID:farhan4648gul,项目名称:sentian,代码行数:32,代码来源:Analyser.php

示例4: parseRoute

 /**
  * 解析路由
  *
  * @return bool
  */
 private function parseRoute()
 {
     //导入路由
     require APP_PATH . '/routes.php';
     //分析处理
     return Route::dispatch();
 }
开发者ID:arnold1119,项目名称:cms,代码行数:12,代码来源:Kernel.php

示例5: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $request = Request::create('/api/blocknotify', 'GET', array('secret' => !$this->option('secret') ? Config::get('bitcoin.callback_secret') : $this->option('secret'), 'blockhash' => $this->option('blockhash')));
     Request::replace($request->input());
     $response = Route::dispatch($request)->getContent();
     if ($this->option('debug')) {
         $this->info($response);
     }
 }
开发者ID:denpamusic,项目名称:EzBitcoin-Api-Wallet,代码行数:14,代码来源:ApiBlocknotify.php

示例6: __construct

 public function __construct()
 {
     $route = new Route();
     require_once "/../Routes.php";
     $route->dispatch();
     $render = $route->result();
     if (is_array($render)) {
         echo json_encode($render);
     } else {
         echo $render;
     }
 }
开发者ID:jackzard,项目名称:JackFramework,代码行数:12,代码来源:Core.php

示例7: bootstrap

 public function bootstrap()
 {
     define('IS_CLI', PHP_SAPI == 'cli');
     define('NOW', $_SERVER['REQUEST_TIME']);
     define('__ROOT__', IS_CLI ? '' : trim('http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']), '/\\'));
     IS_CLI or define('IS_GET', $_SERVER['REQUEST_METHOD'] == 'GET');
     IS_CLI or define('IS_POST', $_SERVER['REQUEST_METHOD'] == 'POST');
     IS_CLI or define('IS_DELETE', $_SERVER['REQUEST_METHOD'] == 'DELETE' ? TRUE : isset($_POST['_method']) && $_POST['_method'] == 'DELETE');
     IS_CLI or define('IS_PUT', $_SERVER['REQUEST_METHOD'] == 'PUT' ? TRUE : isset($_POST['_method']) && $_POST['_method'] == 'PUT');
     IS_CLI or define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
     IS_CLI or define('IS_WEIXIN', isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== FALSE);
     IS_CLI or define('__URL__', trim('http://' . $_SERVER['HTTP_HOST'] . '/' . trim($_SERVER['REQUEST_URI'], '/\\'), '/'));
     IS_CLI or define("__HISTORY__", isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '');
     //加载服务配置项
     $servers = (require __DIR__ . '/service.php');
     $config = (require ROOT_PATH . '/system/config/service.php');
     $servers['providers'] = array_merge($config['providers'], $servers['providers']);
     $servers['facades'] = array_merge($config['facades'], $servers['facades']);
     $this->servers = $servers;
     //自动加载系统服务
     Loader::register([$this, 'autoload']);
     //绑定核心服务提供者
     $this->bindServiceProvider();
     //添加初始实例
     $this->instance('App', $this);
     //设置外观类APP属性
     ServiceFacade::setFacadeApplication($this);
     //定义错误/异常处理
     Error::bootstrap();
     //导入类库别名
     Loader::addMap(c('app.alias'));
     //自动加载文件
     Loader::autoloadFile();
     //启动服务
     $this->boot();
     //CLI模式
     $this->cli();
     //应用开始中间件
     \Middleware::exe('app_start');
     //解析路由
     Route::dispatch();
     //记录日志
     Log::save();
     //中间件
     \Middleware::exe('app_end');
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:46,代码来源:App.php

示例8: __construct

 public function __construct($app)
 {
     $this->app = $app;
     //设置字符集
     header("Content-type:text/html;charset=" . Config::get('app.charset'));
     //时区
     date_default_timezone_set(Config::get('app.timezone'));
     //路由处理
     Route::dispatch();
     //导入钓子
     $app['Hook']->import(Config::get('hook'));
     //定义常量
     $this->DefineConsts();
     //执行控制器方法
     $this->ExecuteAction();
     //保存日志
     Log::save();
 }
开发者ID:Colorado-rom,项目名称:hdphp,代码行数:18,代码来源:Kernel.php

示例9: ruta

 /**
  * Metodo para crear request entre controladores
  * 
  * @param type $url Metodo destino
  * @param type $method Metodo de envio (GET o POST)
  * @param type $data Arreglo de datos
  * @param type $json Si el retorno es json o array
  * @return type JSON o ARRAY
  */
 public static function ruta($url, $method, $data, $json = true)
 {
     //Datos enviados, vector
     Input::replace($data);
     //Crea Request via GET o POST
     $request = Request::create($url, $method);
     //Obtener response
     $response = Route::dispatch($request);
     //Solo contenido, en formato json
     $content = $response->getContent();
     if ($json) {
         //Retorna formato JSON
         return $content;
     } else {
         //Retorna un arreglo
         return json_decode($content);
     }
 }
开发者ID:lueimg,项目名称:activista,代码行数:27,代码来源:Helpers.php

示例10: release

 public function release($url, $method = 'GET', $input, $no_json)
 {
     // Store the original input of the request
     $originalInput = \Request::input();
     // Create request to the API, adding the no-json parameter, since it's an internal request
     $request = \Request::create($url, $method);
     // Replace the input with the request instance input
     \Request::replace($input);
     // Fetch the response
     if ($no_json) {
         $content = \Route::dispatch($request)->getContent();
         $result = json_decode($content, 1);
     } else {
         $result = \Route::dispatch($request)->getContent();
     }
     // Replace the input again with the original request input.
     \Request::replace($originalInput);
     return $result;
 }
开发者ID:kfuchs,项目名称:Laravel-5-Bootstrat-REST-API,代码行数:19,代码来源:InternalDispatcher.php

示例11: cargarDatos

 public function cargarDatos()
 {
     $request = Request::create('/estados', 'GET', array());
     $estados = Route::dispatch($request)->original;
     return View::make('completar', array('nombre' => Input::get('nombre'), 'cotizacion_id' => Input::get('cotizacion_id'), 'pago' => Input::get('pago'), 'cobertura' => Input::get('cobertura'), 'formato' => Input::get('formato'), 'descripcion' => Input::get('descripcion'), 'estados' => $estados, 'tipo' => Input::get('tipo'), 'claveInterna' => Input::get('clave-interna'), 'modelo' => Input::get('modelo'), 'recibos' => Input::get('recibos')));
 }
开发者ID:edgarsandoval,项目名称:aseguro.mx,代码行数:6,代码来源:QuoteController.php

示例12: batch

 /**
  * Batch Operations
  * https://parse.com/docs/rest/guide#objects-batch-operations
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function batch()
 {
     $requests = json_decode(file_get_contents('php://input'));
     $output = array();
     foreach ($requests->requests as $request) {
         $url = parse_url($request->path);
         $query = array();
         if (isset($url['query'])) {
             parse_str($url['query'], $query);
         }
         $body = isset($request->body) ? json_encode($request->body) : null;
         self::$currentRequest = \Request::create($request->path, $request->method, $query, array(), array(), array(), $body);
         $result = json_decode(\Route::dispatch(self::$currentRequest)->getContent());
         if (!property_exists($result, 'error')) {
             $output[] = array("success" => $result);
         } else {
             $output[] = array("error" => $result);
         }
     }
     return \Response::json($output);
 }
开发者ID:nidalb,项目名称:baas,代码行数:27,代码来源:ParseObjectController.php

示例13: function

| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(['middleware' => ['api', 'web']], function ($account) {
    Route::get('/', function () {
        return 'Welcome to application';
    });
    //Route::get('/', function(){
    //	return redirect('/home');
    //});
    Route::get('/posts', function () {
        $token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkb21haW4iOiJ0cmF2ZWwuY29tIiwic3ViIjoxLCJpc3MiOiJodHRwOlwvXC90cmF2ZWwuY29tXC9hcGlcL3YxXC9hdXRoZW50aWNhdGUiLCJpYXQiOjE0NTU2OTM2MDcsImV4cCI6MTQ1NTY5NzIwNywibmJmIjoxNDU1NjkzNjA3LCJqdGkiOiI3NTM0M2YzYTEyYTg1NGI2ZmI5Yjc0MWY2ZDFhYzQ1ZiJ9.3nGMHHXALcOGKPqiiuKqrAmxaJnUQasg1HX3pfYGZyA';
        $request = Request::create(Request::root() . '/api/v1/posts', 'GET', ['token' => $token]);
        $response = Route::dispatch($request)->getData();
        $result = json_decode(json_encode($response), true);
        echo '<pre>';
        print_r($result);
        //return $result;
    });
});
Route::group(['prefix' => 'api/v1', 'middleware' => ['cors', 'api.jwt']], function () {
    Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
    Route::post('authenticate', 'AuthenticateController@authenticate');
    Route::get('authenticate/user', 'AuthenticateController@getAuthenticatedUser');
    Route::get('refresh_token', 'AuthenticateController@refresh_token');
    // Api calls
    Route::resource('posts', 'Api\\V1\\postsController');
    Route::get('my_posts', 'Api\\V1\\postsController@getUserPosts');
});
开发者ID:ganeshkanawade,项目名称:laravel-setup,代码行数:31,代码来源:routes.php

示例14: postAuthForm

 public function postAuthForm()
 {
     //delegate to default api function
     $request = \Request::create(\URL::route('api.auth.auth'), 'POST', \Input::all());
     return \Route::dispatch($request);
 }
开发者ID:AniartUA,项目名称:crm,代码行数:6,代码来源:AuthController.php

示例15: requestOriginalApi

 protected static function requestOriginalApi($uri, $method = 'GET', $params = array())
 {
     $request = Request::create($uri, $method, $params);
     $response = Route::dispatch($request)->getContent();
     return $response;
 }
开发者ID:riferimenti,项目名称:college-web-control,代码行数:6,代码来源:BaseController.php


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