加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

php – Laravel View Make返回空白页面

发布时间:2020-12-14 19:34:34 所属栏目:大数据 来源:网络整理
导读:我在控制器的特定功能中返回视图时遇到了一些问题. 即使在这个控制器中,我的所有视图都在我的应用程序中随处可见.当我尝试返回任何视图,包括我可以返回其他地方的测试视图时,我总是在一个空白页面上.我的日志(PHP和Apache)是空的. 调节器 function firstfct(
我在控制器的特定功能中返回视图时遇到了一些问题.

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

调节器

function firstfct($path){

 $obj = new FooBar($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"
}

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();


 }
 }

test.blade.php

<pre>   
    Done!
</pre>
<hr/>

解决方法

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

更改

function firstfct($path){

 $obj = new FooBar($this);
 $obj->Insert($path);

 }

function firstfct($path){

 $obj = new FooBar($this);
 return $obj->Insert($path);

 }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读