本文介绍了Laravel 5如何使用composer.json清除缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Laravel的新手.我正在尝试清除视图缓存,并且需要在没有作曲家的情况下清除视图缓存.

I am new to Laravel. I am trying to clear view cache, and I need to clear view cache without composer.

是否可以使用composer.json autoload清除缓存?

Is possible to clear cache using composer.json autoload?

我已经尝试了下面的代码,但是没有用.

I have already tried the code below, but it was not working.

Route::get('/view-clear', function() {
    $exitCode = Artisan::call('view:clear');
    return '<h1>View cache cleared</h1>';
});

另外,我应该如何使用...

Also, how should I use...

...在我的代码控制器中.

...in my code controller.

推荐答案

使用Filemanager或简单的PHP代码删除storage\framework\views

With a Filemanager or a Simple PHP Code Delete the compiled views inside of storage\framework\views

示例:

Route::get('/view-clear', function() {
    $directory=storage_path('framework/views');
    $files=File::allFiles($directory);
    File::delete($files);
    return '<h1>View cache cleared</h1>';
});

这篇关于Laravel 5如何使用composer.json清除缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 09:19
查看更多