Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to clear the cache in laravel5

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to clear the cache in laravel5, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

Methods: 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 the configuration cache, and so on.

The operating environment of this tutorial: windows7 system, Laravel5 version, Dell G3 computer.

In many cases, the problem you may encounter is that any changes to the Laravel application are not reflected in the Web interface. This occurs because the cache provides the application. This tutorial will help you clear the cache in your Laravel application.

Clear the 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 for the Laravel application

$php artisan cache:clear

2. Clear the route cache

To clear the route cache for the Laravel application, execute the following command from shell

$php artisan route:cache

3. Clear the configuration cache

You can use config:cache to clear the configuration cache for Laravel applications

$php artisan config:cache

4. Clear the compiled view file

In addition, you may need to clear the compiled view file for the Laravel application. To clear the compiled view file, run the following command from the terminal

$php artisan view:clear

5. Clear the cache in Laravel (browser)

Most shared host providers do not provide SSH access to the system. In this case, you can clear the Laravel cache by calling URL in the browser. Just put the following code in the routes / web.php file of the Laravel application. Then access this URL in a browser to clear the cache of the Laravel application

Route::get ('/ clear-cache', function () {Artisan::call ('cache:clear'); return "Cache is cleared";}); that's all about the article "how to clear the cache in laravel5". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report