[英]Call view from function of controller
这是TestController的两个版本,我认为它们是相同的,TestController调用了welcome.blade.php文件。
作为此代码的结果,显示了“欢迎”视图。
class TestController extends Controller
{
public function first($status)
{
if($status==0)
return view::make('welcome');
}
}
但是这段代码只会创建一个空白页,为什么会这样呢?
class TestController extends Controller
{
public function test()
{
return view::make('welcome');
}
public function first($status)
{
if($status==0)
$this->test();
}
}
您应该从控制器方法返回视图:
public function first($status)
{
if ($status === 0)
return $this->test();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.