e
This commit is contained in:
@@ -5,16 +5,18 @@ namespace HttpServer\IInterface;
|
||||
|
||||
|
||||
use Closure;
|
||||
use HttpServer\Http\Request;
|
||||
|
||||
interface After
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param $params
|
||||
* @param Closure|null $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function onHandler($params, $next);
|
||||
public function onHandler(Request $request, $params, $next);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ class Reduce
|
||||
public static function after($middleWares)
|
||||
{
|
||||
return array_reduce(array_reverse($middleWares), function ($stack, $pipe) {
|
||||
return function ($passable) use ($stack, $pipe) {
|
||||
return function ($request, $passable) use ($stack, $pipe) {
|
||||
if ($pipe instanceof After) {
|
||||
return $pipe->onHandler($passable, $stack);
|
||||
return $pipe->onHandler($request, $passable, $stack);
|
||||
} else {
|
||||
return $pipe($passable, $stack);
|
||||
return $pipe($request, $passable, $stack);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -172,5 +172,49 @@
|
||||
// var_dump($value);
|
||||
//}
|
||||
|
||||
exec('ps -ef 15132 | grep 15132', $output);
|
||||
var_dump($output);
|
||||
//exec('ps -ef 15132 | grep 15132', $output);
|
||||
//var_dump($output);
|
||||
|
||||
//
|
||||
//Swoole\Coroutine::create(function () {
|
||||
// var_dump(\Swoole\Coroutine::getCid());
|
||||
////
|
||||
//// Swoole\Coroutine::create(function () {
|
||||
//// var_dump(\Swoole\Coroutine::getPcid());
|
||||
//// Swoole\Coroutine::create(function () {
|
||||
//// var_dump(\Swoole\Coroutine::getPcid());
|
||||
//// Swoole\Coroutine::create(function () {
|
||||
//// var_dump(\Swoole\Coroutine::getPcid());
|
||||
//// Swoole\Coroutine::create(function () {
|
||||
//// var_dump(\Swoole\Coroutine::getPcid());
|
||||
//// });
|
||||
//// });
|
||||
//// });
|
||||
//// });
|
||||
// Swoole\Coroutine::create(function () {
|
||||
// var_dump(\Swoole\Coroutine::getPcid());
|
||||
// });
|
||||
// Swoole\Coroutine::create(function () {
|
||||
// var_dump(\Swoole\Coroutine::getPcid());
|
||||
// });
|
||||
// Swoole\Coroutine::create(function () {
|
||||
// var_dump(\Swoole\Coroutine::getPcid());
|
||||
// });
|
||||
//});
|
||||
|
||||
|
||||
Swoole\Coroutine::create(function () {
|
||||
|
||||
class b
|
||||
{
|
||||
public function et()
|
||||
{
|
||||
var_dump(\Swoole\Coroutine::getPcid(), microtime(true));
|
||||
\Swoole\Coroutine::sleep(0.01);
|
||||
}
|
||||
}
|
||||
|
||||
for ($a = 0; $a < 10; $a++) {
|
||||
Swoole\Coroutine::create([new b(), 'et']);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user