[英]Where is the implementation of '$app->run()' in Lumen?
它在Laravel\\Lumen\\Concerns\\RoutesRequests
。
如果您查看bootstrap/app.php
您會看到:
$app = new Laravel\Lumen\Application(
dirname(__DIR__)
);
所以我們知道$app
是Laravel\\Lumen\\Application
一個實例。
方法run()
沒有在這個類上定義,但如果你仔細觀察,你會看到:
class Application extends Container
{
use Concerns\RoutesRequests,
Concerns\RegistersExceptionHandlers;
這些特征為類定義了額外的行為。 具體來說,在Laravel\\Lumen\\Concerns\\RoutesRequests
你會發現:
/**
* Run the application and send the response.
*
* @param SymfonyRequest|null $request
* @return void
*/
public function run($request = null)
{
$response = $this->dispatch($request);
if ($response instanceof SymfonyResponse) {
$response->send();
} else {
echo (string) $response;
}
if (count($this->middleware) > 0) {
$this->callTerminableMiddleware($response);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.