Laravel View Make返回空白页面

Wis*_*tar 3 php view laravel

我在控制器的特定功能中返回视图时遇到了一些问题.

即使在这个控制器中,我的所有视图都在我的应用程序中随处可见.当我尝试返回任何视图,包括我可以返回其他地方的测试视图时,我总是在一个空白页面上.我的日志(PHP和Apache)是空的.

调节器

function firstfct($path){

 $obj = new Foo\Bar($this);
 $obj->Insert($path);

 }

function ReturnsBlank(){

        //Fetching some variables that I was able to dump

       return \View::make('test'); //Blank
       //return var_dump('FooBar'); // Returns "FooBar"
}
Run Code Online (Sandbox Code Playgroud)

Foo/bar文件

class SomeClass{

protected $listener;

public function __construct($listener)
{

$this->listener = $listener;

}

function Insert($path){ 

 //Some stuff that it is working well
 return $this->listener->ReturnsBlank();


 }
 }
Run Code Online (Sandbox Code Playgroud)

test.blade.php

<pre>   
    Done!
</pre>
<hr/>
Run Code Online (Sandbox Code Playgroud)

Lau*_*nce 7

问题是你的firstfct控制器实际上没有向Laravel"返回"任何东西.视图被'返回'到函数firstfct - 但是你需要传递它

更改

function firstfct($path){

 $obj = new Foo\Bar($this);
 $obj->Insert($path);

 }
Run Code Online (Sandbox Code Playgroud)

function firstfct($path){

 $obj = new Foo\Bar($this);
 return $obj->Insert($path);

 }
Run Code Online (Sandbox Code Playgroud)