Laravel view not found exception

前端 未结 16 1678
遇见更好的自我
遇见更好的自我 2020-11-29 03:44

I have problem with laravel view is not found by route function I did composer dumpautoload but no use ArticleController.php



        
相关标签:
16条回答
  • 2020-11-29 03:46

    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.

    Note that Laravel will do the following when calling View::make:

    • 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.

    The file can have any of those two extensions: .php or .blade.php.

    0 讨论(0)
  • 2020-11-29 03:46

    This error also occurs when you try to move the whole project directory to other path. And you happened to run the following commands below BEFORE you move.

    php artisan optimize --force
    php artisan config:cache
    php artisan route:cache
    

    Mine error message shows like this

    As you can see the old path was written in the compiled.php. So, to fix the problem. Simply run the same command AGAIN under the project folder in your new folder location.

    php artisan optimize --force
    php artisan config:cache
    php artisan route:cache
    

    Hope this helps.

    0 讨论(0)
  • 2020-11-29 03:51

    This might be possible that your view is present even though it shows the error. So to solve this issue you need to stop the server and run this command on the terminal.

    php artisan config:cache
    

    then restart the server

    0 讨论(0)
  • 2020-11-29 03:53

    This command works for me

    php artisan config:cache
    

    As Laravel doc says that by default, Laravel is configured to use the file cache driver, which stores the serialized, cached objects in the filesystem. So it needs to recache the file system so that newly added views and route are available to show. I also not sure why laravel needs to recache actually

    0 讨论(0)
  • 2020-11-29 03:53

    check your blade syntax on the view that said not found i just fix mine

    @if
    @component
    @endif 
    @endcomponent
    

    to

    @if
    @component
    @endcomponent
    @endif 
    
    0 讨论(0)
  • 2020-11-29 03:54

    As @deanchiu said it may happen when you move the whole project to another path or server.

    But in my case I had no access to command line on server and running following commands BEFORE I upload my project helped me.

    > php artisan route:clear
    > php artisan config:clear
    
    0 讨论(0)
提交回复
热议问题