【发布时间】:2015-04-20 05:52:40
【问题描述】:
以下是我的控制器类,
namespace Admin;
class CategoriesController extends \BaseController {
public function index($action = '', $id= ''){
//return \View::make('welcome');View is correctly rendered here
switch ($action){
case '' :
case 'list' : $this->showList();
break;
case 'add' : $this->addCategories();
break;
case 'edit' : $this->editCategories($id);
break;
}
}
public function showList($id_category =''){
echo "testing";
return \View::make('welcome'); //it does not work here
}
在调用视图时,它在函数 showList() 中不起作用。函数内的回显有效,但视图只返回一个空白页而没有任何错误。这可能是什么问题?
【问题讨论】:
-
dd(\View::make('welcome'));显示?在 laravel 5 中,我建议您改用 view()。问题可能是由于名称空间,因为 View 是 Illuminate\Support\Facades\View 而不是 \View
-
它正在打印视图。错误在于回报。感谢您的关心。