Laravel view not found exception(Laravel 视图未发现异常)
问题描述
我的路由函数找不到 laravel 视图的问题我做了 composer dumpautoload 但没有用ArticleController.php
I have problem with laravel view is not found by route function I did composer dumpautoload but no use ArticleController.php
<?php
class ArticleController extends BaseController
 {
 public function showIndex()
 {
    return View::make('index');
 }
 public function showSingle($articleId)
 {
 return View::make('single');
 }
}
//Route
Route::get('index', 'ArticleController@showIndex');
无效参数异常
View [index] not found.
open: /opt/lampp/htdocs/laravel-project/bootstrap/compiled.php
    foreach ((array) $paths as $path) {
    foreach ($this->getPossibleViewFiles($name) as $file) {
    if ($this->files->exists($viewPath = $path . '/' . $file)) {
    return $viewPath;
    }
    }
    }
    throw new InvalidArgumentException("View [{$name}] not found.");
    }
    protected function getPossibleViewFiles($name)
Server/Request Data
REDIRECT_UNIQUE_ID  UfWlAn8AAQEAABR2VakAAAAF
REDIRECT_STATUS     200
UNIQUE_ID   UfWlAn8AAQEAABR2VakAAAAF
HTTP_HOST   localhost
HTTP_USER_AGENT     Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0
HTTP_ACCEPT     text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE    en-US,en;q=0.5
HTTP_ACCEPT_ENCODING    gzip, deflate
HTTP_COOKIE     laravel_session=f94fpel78jn89nhah32mflqn15
HTTP_CONNECTION     keep-alive
HTTP_CACHE_CONTROL  max-age=0
PATH    /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
LD_LIBRARY_PATH     /opt/lampp/lib:/opt/lampp/lib
SERVER_SIGNATURE    
SERVER_SOFTWARE     Apache/2.4.4 (Unix) OpenSSL/1.0.1e PHP/5.4.16 mod_perl/2.0.8-dev Perl/v5.16.3
SERVER_NAME     localhost
SERVER_ADDR     127.0.0.1
SERVER_PORT     80
REMOTE_ADDR     127.0.0.1
DOCUMENT_ROOT   /opt/lampp/htdocs
REQUEST_SCHEME  http
CONTEXT_PREFIX  
CONTEXT_DOCUMENT_ROOT   /opt/lampp/htdocs
SERVER_ADMIN    you@example.com
SCRIPT_FILENAME     /opt/lampp/htdocs/laravel-project/public/index.php
REMOTE_PORT     50211
REDIRECT_URL    /laravel-project/public/index
GATEWAY_INTERFACE   CGI/1.1
SERVER_PROTOCOL     HTTP/1.1
REQUEST_METHOD  GET
QUERY_STRING    
REQUEST_URI     /laravel-project/public/index
SCRIPT_NAME     /laravel-project/public/index.php
PHP_SELF    /laravel-project/public/index.php
REQUEST_TIME_FLOAT  1375053058.123
REQUEST_TIME    1375053058
推荐答案
当 Laravel 在您的应用程序中找不到视图文件时会发生这种情况.确保您的 app/views 目录下有一个名为:index.php 或 index.blade.php 的文件.
This happens when Laravel doesn't find a view file in your application. Make sure you have a file named: index.php or index.blade.php under your app/views directory.
请注意,Laravel 在调用 View::make 时会执行以下操作:
Note that Laravel will do the following when calling View::make:
- 对于 
View::make('index'),Laravel 会查找文件:app/views/index.php. - 对于 
View::make('index.foo'),Laravel 会查找文件:app/views/index/foo.php. 
- For 
View::make('index')Laravel will look for the file:app/views/index.php. - For 
View::make('index.foo')Laravel will look for the file:app/views/index/foo.php. 
该文件可以具有以下两个扩展名中的任何一个:.php 或 .blade.php.
The file can have any of those two extensions: .php or .blade.php.
这篇关于Laravel 视图未发现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Laravel 视图未发现异常
				
        
 
            
        - Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
 - 正确分离 PHP 中的逻辑/样式 2021-01-01
 - Laravel 仓库 2022-01-01
 - PHP Count 布尔数组中真值的数量 2021-01-01
 - SoapClient 设置自定义 HTTP Header 2021-01-01
 - 带有通配符的 Laravel 验证器 2021-01-01
 - 从 PHP 中的输入表单获取日期 2022-01-01
 - Mod使用GET变量将子域重写为PHP 2021-01-01
 - 如何定位 php.ini 文件 (xampp) 2022-01-01
 - 没有作曲家的 PSR4 自动加载 2022-01-01
 
				
				
				
				