* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*/
public function abort($code, $message = '', array $headers = [])
{
if ($code == 404) {
throw new NotFoundHttpException($message);
}
throw new HttpException($code, $message, null, $headers);
}
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
function abort($code, $message = '', array $headers = [])
{
app()->abort($code, $message, $headers);
}
}
if (! function_exists('app')) {
/**
$urlPath = explode('/', $this->request->path());
// 获取城市code
$this->cityCode = $this->request->route('cityCode');
if (isset($this->cityCode) && $this->cityCode != 'sh') abort(404);
$this->cityCode = 'sh';
$this->cityID = 1;
view()->share('cityCode', $this->cityCode);
/**
* 初始化
*/
public function __construct()
{
parent::__construct();
$this->_news = new NewsModel();
}
// 城市首页
throw $e;
}
array_pop($this->buildStack);
return $reflector->newInstanceArgs($instances);
}
/**
* Resolve all of the dependencies from the ReflectionParameters.
*
// We're ready to instantiate an instance of the concrete type registered for
// the binding. This will instantiate the types, as well as resolve any of
// its "nested" dependencies recursively until all have gotten resolved.
if ($this->isBuildable($concrete, $abstract)) {
$object = $this->build($concrete);
} else {
$object = $this->make($concrete);
}
// If we defined any extenders for this type, we'll need to spin through them
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function make($abstract, array $parameters = [])
{
return $this->resolve($abstract, $parameters);
}
/**
* {@inheritdoc}
*
$this->{$method = $this->availableBindings[$abstract]}();
$this->ranServiceBinders[$method] = true;
}
return parent::make($abstract, $parameters);
}
/**
* Register container bindings for the application.
*
$uses .= '@__invoke';
}
[$controller, $method] = explode('@', $uses);
if (! method_exists($instance = $this->make($controller), $method)) {
throw new NotFoundHttpException;
}
if ($instance instanceof LumenController) {
return $this->callLumenController($instance, $method, $routeInfo);
protected function callActionOnArrayBasedRoute($routeInfo)
{
$action = $routeInfo[1];
if (isset($action['uses'])) {
return $this->prepareResponse($this->callControllerAction($routeInfo));
}
foreach ($action as $value) {
if ($value instanceof Closure) {
$callable = $value->bindTo(new RoutingClosure);
return $this->callActionOnArrayBasedRoute($this['request']->route());
}));
}
return $this->prepareResponse(
$this->callActionOnArrayBasedRoute($routeInfo)
);
}
/**
* Call the Closure or invokable on the array based route.
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));
}
*/
protected function prepareDestination(BaseClosure $destination)
{
return function ($passable) use ($destination) {
try {
return $destination($passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
}
$this->startSession($request, $session)
);
$this->collectGarbage($session);
$response = $next($request);
$this->storeCurrentUrl($request, $session);
$this->addCookieToResponse($response, $session);
if ($this->manager->shouldBlock() ||
($request->route() instanceof Route && $request->route()->locksFor())) {
return $this->handleRequestWhileBlocking($request, $session, $next);
}
return $this->handleStatefulRequest($request, $session, $next);
}
/**
* Handle the given request within session state.
*
// 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'));
}
}
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();
NotFoundHttpException
|
---|
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: at /data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php:31 at Laravel\Lumen\Application->abort() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/helpers.php:24) at abort() (/data/wwwroot/hsz/hsz-web-php/app/Http/Controllers/Controller.php:46) at App\Http\Controllers\Controller->__construct() (/data/wwwroot/hsz/hsz-web-php/app/Http/Controllers/Cn/HomeController.php:16) at App\Http\Controllers\Cn\HomeController->__construct() at ReflectionClass->newInstanceArgs() (/data/wwwroot/hsz/hsz-web-php/vendor/illuminate/container/Container.php:917) at Illuminate\Container\Container->build() (/data/wwwroot/hsz/hsz-web-php/vendor/illuminate/container/Container.php:758) at Illuminate\Container\Container->resolve() (/data/wwwroot/hsz/hsz-web-php/vendor/illuminate/container/Container.php:694) at Illuminate\Container\Container->make() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Application.php:300) at Laravel\Lumen\Application->make() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:324) at Laravel\Lumen\Application->callControllerAction() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:282) at Laravel\Lumen\Application->callActionOnArrayBasedRoute() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:267) at Laravel\Lumen\Application->handleFoundRoute() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:237) at Laravel\Lumen\Application->handleDispatcherResponse() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:173) at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:48) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/data/wwwroot/hsz/hsz-web-php/vendor/illuminate/session/Middleware/StartSession.php:121) at Illuminate\Session\Middleware\StartSession->handleStatefulRequest() (/data/wwwroot/hsz/hsz-web-php/vendor/illuminate/session/Middleware/StartSession.php:64) at Illuminate\Session\Middleware\StartSession->handle() (/data/wwwroot/hsz/hsz-web-php/vendor/illuminate/pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/data/wwwroot/hsz/hsz-web-php/vendor/illuminate/pipeline/Pipeline.php:103) at Illuminate\Pipeline\Pipeline->then() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:426) at Laravel\Lumen\Application->sendThroughPipeline() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:175) at Laravel\Lumen\Application->dispatch() (/data/wwwroot/hsz/hsz-web-php/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:112) at Laravel\Lumen\Application->run() (/data/wwwroot/hsz/hsz-web-php/public/index.php:28) |