在FileViewFinder.php第137行中的Laravel 5 InvalidArgumentException:找不到视图[.admin] [英] Laravel 5 InvalidArgumentException in FileViewFinder.php line 137: View [.admin] not found

查看:135
本文介绍了在FileViewFinder.php第137行中的Laravel 5 InvalidArgumentException:找不到视图[.admin]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 student.php ,我的管理员功能是

This is student.php and my function for admin:

 public function admin(Request $request){

       if($request->isMethod('get')){
       return \View::make('/admin');
    }
       else
        {

                 $UserData['email'] = Input::get('username');
                 $UserData['password'] = Input::get('password');
                 User::create($UserData);
                 return 'admintest';
                 //return Redirect::to('/view');
         }
   }   

routes.php

      Route::match(['get', 'post'], '/admin', 'student@admin');

这是管理表单:

     {!! Form::open(array('url' => '/admin')) !!}
  <input type="hidden" name="_token" value="{{ csrf_token() }}">


    User Name:<br />
      <input name="username" type="text" id="username" size="40" />
    <br /><br />
    Password:<br />
   <input name="password" type="password" id="password" size="40" />
   <br />
   <br />
   <br />

     <input type="submit" name="button" id="button" value="Log In" />


  {!! Form::close() !!}

不知道为什么显示错误:

Don't know why showing error:

FileViewFinder.php第137行中的

InvalidArgumentException: 查看未找到[.]

InvalidArgumentException in FileViewFinder.php line 137: View [.] not found

推荐答案

视图应扩展为.blade.php.

因此,具有管理表单的文件应具有名称admin.blade.php

So your file that has the admin form should have the name admin.blade.php

注意:

如果您在任何子目录(例如somefolder/admin.blade.php

If you have the view under any sub directory like somefolder/admin.blade.php

那么您应该这样做

return \View::make('somefolder/admin');

在此处了解有关模板的更多信息:)

Learn more about templating here :)

这篇关于在FileViewFinder.php第137行中的Laravel 5 InvalidArgumentException:找不到视图[.admin]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆