Home > PHP Framework > Laravel > body text

How to clear cache in laravel5

青灯夜游
Release: 2023-01-13 00:40:25
Original
2391 people have browsed it

Method: 1. Execute the "php artisan cache:clear" command to clear the program cache; 2. Execute the "php artisan route:cache" command to clear the route cache; 3. Execute the "php artisan config:cache" command to clear it Configure caching and more.

How to clear cache in laravel5

The operating environment of this tutorial: Windows 7 system, Laravel version 5, Dell G3 computer.

Many times, the problem you may encounter is that any changes in the Laravel application are not reflected on the web interface. This happens due to cache serving application. This tutorial will help you clear cache in Laravel application.

Clear cache in Laravel (terminal)

Log in to the system running the laravel application and open the terminal. Then navigate to the Laravel application code. Here, you can use the following command to clear the cache:

1. Clear the application cache

Run the following command to clear the application cache of the Laravel application

$ php artisan cache:clear
Copy after login

2. Clear the routing cache

To clear the routing cache of the Laravel application, please execute the following command from the shell

$ php artisan route:cache
Copy after login

3. Clear Configuration cache

You can use config:cache to clear the configuration cache of the Laravel application

$ php artisan config:cache
Copy after login

4. Clear the compiled view files

In addition, you may also need to clear the compiled view files of your Laravel application. To clear the compiled view files, run the following command from the terminal

$ php artisan view:clear
Copy after login

5. Clear cache in Laravel (browser)

Most shared hosting providers Does not provide SSH access to the system. In this case, the Laravel cache can be cleared by calling the URL in the browser. Simply place the following code in the routes/web.php file of your Laravel application. Then visit this URL in your browser to clear the cache of your Laravel application

Route::get('/clear-cache', function() {
 
    Artisan::call('cache:clear');
 
    return "Cache is cleared";
 
});
Copy after login

Related recommendations:The latest five Laravel video tutorials

The above is the detailed content of How to clear cache in laravel5. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!