我对laravel视图有问题,找不到路由函数,我做了作曲家dumpautoload但没有使用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');
InvalidArgumentException
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在您的应用程序中找不到视图文件时,就会发生这种情况。确保你有一个文件名为:index.php或者index.blade.php你在app/views目录中。
index.php
index.blade.php
app/views
请注意,在调用时Laravel将执行以下操作View::make:
View::make
View::make('index')
app/views/index.php
View::make('index.foo')
app/views/index/foo.php
该文件可以具有以下两个扩展名之一:.php或.blade.php。
.php
.blade.php