php - Laravel View Make 返回空白页

标签 php laravel view

我在返回 Controller 特定功能的 View 时遇到了一些问题。

我的所有 View 都在我的应用程序的任何地方正常返回,即使在这个 Controller 中也是如此。当我尝试返回任何 View 时,包括我可以在其他地方返回的测试 View ,我总是以空白页结束。我的日志(PHP 和 Apache)是空的。

Controller

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"
}

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 Controller 实际上并没有“返回”任何东西给 Laravel。该 View “返回”给函数 firstfct - 但您需要将其传递给函数

改变

function firstfct($path){

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

 }

function firstfct($path){

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

 }

关于php - Laravel View Make 返回空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23636483/

相关文章:

php - tempus dominus pre select multidate from value 属性

php - 为什么在 MySQL 中使用 SUM() 时会得到重复的值?

mysql - 浅谈MySQL中 View 的 View 的使用效率

android - View 和 subview 之间的区别 - Android

安卓.view.InflateException : Binary XML file line #33: Error inflating class

php - 自动更改空格和下划线

php - 在哪里以及如何在 Laravel 5 中创建存储过程

php - Laravel 5,ajax,500 内部服务器错误,VerifyCsrfToken.php 第 46 行 : 中的 TokenMismatchException

php - Laravel whereJsonContains 查询在 5.7 中不起作用

数组循环内的 Javascript 价格和数量调整