Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
FileViewFinder.php第137行中的Laravel 5 InvalidArgumentException:未找到视图[.admin]_Php_Laravel_Laravel 5 - Fatal编程技术网

FileViewFinder.php第137行中的Laravel 5 InvalidArgumentException:未找到视图[.admin]

FileViewFinder.php第137行中的Laravel 5 InvalidArgumentException:未找到视图[.admin],php,laravel,laravel-5,Php,Laravel,Laravel 5,这是student.php和我的管理员功能: public function admin(Request $request){ if($request->isMethod('get')){ return \View::make('/admin'); } else { $UserData['email'] = Input::get('username');

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

 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() !!}
{!!Form::open(数组('url'=>'/admin'))
用户名:


密码:



{!!Form::close()!!}
不知道为什么显示错误:

FileViewFinder.php第137行中的InvalidArgumentException: 未找到视图[。]


您不希望引用以斜线开头的视图

这:

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

应该是这样的:


return\View::make('admin')

视图应该是一个扩展名
.blade.php

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

注意:

如果您有任何子目录下的视图,如
somefolder/admin.blade.php

那么你应该这样做

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


在此处了解更多信息:)

如果上述任何答案不起作用。为什么不尝试将config.phpproject/bootstrap/cache/config.php的名称修改为另一个名称,如config.php.old它对我使用laravel 5.3很有效请首先检查文件夹是否在views文件夹下 i、 e
resources/views/foldername/filename

然后你可以测试

Route::get('route_name', function () {
    return view('foldername.file_name');
});

如果您最近将项目部署到生产服务器或将项目移动到其他服务器,请不要忘记运行这些命令来清除应用缓存

php artisan cache:clear
php artisan view:clear
php artisan config:cache
它应该会解决它


还考虑更新<代码> .eV文件以匹配新的环境变量。

< P>我遇到了同样的问题,因为我有一个反斜杠<代码> \/COD>,解决方案是将它改为斜线:

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

Laravel有一个身份验证框架生成器,它可能在项目的当前状态之前使用过。我犯了这个错误,我来自一个git克隆,在分享良好实践时忽略了Laravel extra

通过重新发出命令

php artisan make:auth

包含管理表单的文件名是什么?给出视图所讨论的完整名称。。我不明白你想退回管理员表格。不是吗?因为我刚要打开管理员表单。。它向我显示了这个错误。是的,包含管理表单的文件名是什么?您能否提供有关更新环境变量的.env文件的更多详细信息?顺便说一句,清除应用缓存有效,谢谢!将laravel应用程序从开发环境部署到生产环境时,应更新项目根目录下.env文件中的常量。例如
APP\u URL=http://localhost
在dev中应该是
APP\u URL=https://domain.tld
在生产环境中。在推送到其他环境时,应始终排除该文件。在每次编辑.env文件之后,您还需要运行
php artisan config:cache
,否则laravel将无法识别新常量。