if (Str::contains($agent, ['Baiduspider', 'Sogou web spider', 'YoudaoBot', '360Spider', 'Bytespider', 'Yisou'])){
if(Str::of($url)->endsWith(['.js', '.css', '.jpg', '.png', '.ico'])){
return $next($request);
}else{
$spider_type = check_spider();
$client->incr($spider_type.'_hours_'.date('m-d H:00'));
$client->incr($spider_type.'_daily_'.date('m-d'));
$path_domains = get_path_settings();
if($path_domains['local_domain'] == 'default.example.com'){
$scheme = request()->getScheme();
$server_name = $_SERVER['HTTP_HOST'];
if (Str::contains($agent, ['Baiduspider', 'Sogou web spider', 'YoudaoBot', '360Spider', 'Bytespider', 'Yisou'])){
if(Str::of($url)->endsWith(['.js', '.css', '.jpg', '.png', '.ico'])){
return $next($request);
}else{
$spider_type = check_spider();
$client->incr($spider_type.'_hours_'.date('m-d H:00'));
$client->incr($spider_type.'_daily_'.date('m-d'));
$path_domains = get_path_settings();
if($path_domains['local_domain'] == 'default.example.com'){
$scheme = request()->getScheme();
$server_name = $_SERVER['HTTP_HOST'];
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
return ($slice($stack, $pipe))($passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}else{
abort(404);
}
}
return $next($request);
}
}
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
return ($slice($stack, $pipe))($passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
# 屏蔽请求头 'Bytespider',
$black_agent = ['Googlebot','bingbot','MJ12bot','AhrefsBot','DNSPod-Monitor','BLEXBot','EasouSpider','YandexBot','TestBot/0.1','SemrushBot',];
if(Str::of($request->server('HTTP_USER_AGENT'))->contains($black_agent)){
return response(view('path.error.nginx'), 404);
}
return $next($request);
}
}
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
return ($slice($stack, $pipe))($passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
{
$pipeline = array_reduce(
array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
);
return $pipeline($this->passable);
}
/**
* Run the pipeline and return the result.
*
{
if (count($middleware) > 0 && ! $this->shouldSkipMiddleware()) {
return (new Pipeline($this))
->send($this->make('request'))
->through($middleware)
->then($then);
}
return $then($this->make('request'));
}
if (isset($action['middleware'])) {
$middleware = $this->gatherMiddlewareClassNames($action['middleware']);
return $this->prepareResponse($this->sendThroughPipeline($middleware, function () {
return $this->callActionOnArrayBasedRoute($this['request']->route());
}));
}
return $this->prepareResponse(
$this->callActionOnArrayBasedRoute($routeInfo)
);
case Dispatcher::NOT_FOUND:
throw new NotFoundHttpException;
case Dispatcher::METHOD_NOT_ALLOWED:
throw new MethodNotAllowedHttpException($routeInfo[1]);
case Dispatcher::FOUND:
return $this->handleFoundRoute($routeInfo);
}
}
/**
* Handle a route found by the dispatcher.
if (isset($this->router->getRoutes()[$method.$pathInfo])) {
return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
->send($this->make('request'))
->through($middleware)
->then($then);
}
return $then($this->make('request'));
}
/**
* Prepare the response for sending.
*
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
}
* @param \Symfony\Component\HttpFoundation\Request|null $request
* @return void
*/
public function run($request = null)
{
$response = $this->dispatch($request);
if ($response instanceof SymfonyResponse) {
$response->send();
} else {
echo (string) $response;
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
RedisException
|
---|
RedisException: MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error. at /www/wwwroot/lzsecondhospital.com/app/Http/Middleware/LoggingMiddleware.php:35 at Redis->incr() (/www/wwwroot/lzsecondhospital.com/app/Http/Middleware/LoggingMiddleware.php:35) at App\Http\Middleware\LoggingMiddleware->handle() (/www/wwwroot/lzsecondhospital.com/vendor/illuminate/pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/www/wwwroot/lzsecondhospital.com/app/Http/Middleware/StaticMiddleware.php:49) at App\Http\Middleware\StaticMiddleware->handle() (/www/wwwroot/lzsecondhospital.com/vendor/illuminate/pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/www/wwwroot/lzsecondhospital.com/app/Http/Middleware/BlackListMiddleware.php:33) at App\Http\Middleware\BlackListMiddleware->handle() (/www/wwwroot/lzsecondhospital.com/vendor/illuminate/pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/www/wwwroot/lzsecondhospital.com/vendor/illuminate/pipeline/Pipeline.php:103) at Illuminate\Pipeline\Pipeline->then() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:426) at Laravel\Lumen\Application->sendThroughPipeline() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:263) at Laravel\Lumen\Application->handleFoundRoute() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:237) at Laravel\Lumen\Application->handleDispatcherResponse() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:173) at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:429) at Laravel\Lumen\Application->sendThroughPipeline() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:175) at Laravel\Lumen\Application->dispatch() (/www/wwwroot/lzsecondhospital.com/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:112) at Laravel\Lumen\Application->run() (/www/wwwroot/lzsecondhospital.com/public/index.php:28) |