当我们想要返回“welcome”视图时,return View::make("welcome") 和 return Response::view("welcome") 有什么不同吗?
如果有不同,那是什么?什么时候应该使用Response::view(),什么时候应该使用View::make()?
小智 5
每个响应都包含一个视图。在您的示例中,没有区别。但是使用 Response::view() 你也可以设置响应头。
Response::view('hello')->header('Content-Type', $type);
Run Code Online (Sandbox Code Playgroud)
View::make 始终是 HTML,响应可以是 XML、JSON..