Beispiel #1
0
 /**
  * 每个请求层,最终被调用的方法
  *
  * @return mixed
  */
 public function handle()
 {
     Base::getLog()->debug(__METHOD__ . ' handle request flow - start');
     $request = new Request($this->flow->contexts['uri']);
     // 上下文
     $this->flow->contexts['request'] = $request;
     // 处理HTTP相关,例如过滤变量,初始化相关设置
     $flow = Flow::instance('tourze-http');
     $flow->contexts =& $this->flow->contexts;
     $flow->layers = ['tourze\\Bootstrap\\Flow\\Http\\Initialization', 'tourze\\Bootstrap\\Flow\\Http\\Authentication', 'tourze\\Bootstrap\\Flow\\Http\\Authorization'];
     $flow->start();
     // 执行请求
     $response = $request->execute();
     echo $response->sendHeaders(true)->body;
     Base::getLog()->debug(__METHOD__ . ' handle request flow - end');
 }
Beispiel #2
0
<?php

use tourze\Base\Base;
use tourze\Bootstrap\Bootstrap;
use tourze\Flow\Flow;
require '../bootstrap.php';
/**
 * SDK启动
 */
$app = Base::instance();
// 主工作流
$flow = Flow::instance('sdk');
$flow->contexts = ['app' => $app];
$flow->layers = Bootstrap::$layers;
$flow->start();