Browse Source

添加中间件

dev
mike 4 years ago
parent
commit
c87ede7be0
  1. 29
      app/Middleware/HookMallocMiddleware.php

29
app/Middleware/HookMallocMiddleware.php

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use function trackerHookMalloc;
class HookMallocMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (function_exists('trackerHookMalloc')) {
trackerHookMalloc();
}
return $handler->handle($request);
}
}
Loading…
Cancel
Save