我有一个全新安装的laravel 4.2在玩了一些创建一些路线后,我最终启用了运行命令“php artisan routes”以列出我的应用程序的所有可用路由。错误消息:
PHP Fatal error: Call to a member function render() on a non-object in /Users/imac/Sites/my-app/vendor/laravel/framework/src/Illuminate/Console/Command.php on line 276
PHP Stack trace:
PHP 1. {main}() /Users/imac/Sites/my-app/artisan:0
PHP 2. Symfony\Component\Console\Application->run() /Users/imac/Sites/my-app/artisan:59
PHP 3. Symfony\Component\Console\Application->doRun() /Users/imac/Sites/my-app/vendor/symfony/console/Symfony/Component/Console/Application.php:124
PHP 4. Symfony\Component\Console\Application->doRunCommand() /Users/imac/Sites/my-app/vendor/symfony/console/Symfony/Component/Console/Application.php:193
PHP 5. Illuminate\Console\Command->run() /Users/imac/Sites/my-app/vendor/symfony/console/Symfony/Component/Console/Application.php:897
PHP 6. Symfony\Component\Console\Command\Command->run() /Users/imac/Sites/my-app/vendor/laravel/framework/src/Illuminate/Console/Command.php:100
PHP 7. Illuminate\Console\Command->execute() /Users/imac/Sites/my-app/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
PHP 8. Illuminate\Foundation\Console\RoutesCommand->fire() /Users/imac/Sites/my-app/vendor/laravel/framework/src/Illuminate/Console/Command.php:112
PHP 9. Illuminate\Foundation\Console\RoutesCommand->displayRoutes() /Users/imac/Sites/my-app/vendor/laravel/framework/src/Illuminate/Foundation/Console/RoutesCommand.php:74
PHP 10. Illuminate\Console\Command->table() /Users/imac/Sites/my-app/vendor/laravel/framework/src/Illuminate/Foundation/Console/RoutesCommand.php:123
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to a member function render() on a non-object","file":"\/Users\/imac\/Sites\/my-app\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php","line":276}}
我最终恢复了所有的routes.php并保留了这条路线:
Route::get('/', function()
{
return "Homepage here";
});
我搜索了很多,但似乎没有人遇到过这种错误。
答案 0 :(得分:1)
我可以确认4.2上有一个错误。我只是:
git clone -b develop https://github.com/laravel/laravel.git
composer update
php artisan routes
得到了同样的错误。
答案 1 :(得分:0)
请确保在routes.php文件中有Route :: resource('[routename]','[controllername]');您可以在此处查看其文档中的更多内容laravel docs on controllers