就在我準備跑步的時候:
php artisan cache:clear
php artisan view:clear
php artisan route:clear
...出于除錯目的,我最終php artisan clear改為運行。我得到了以下輸出:
已洗掉的已編譯服務和??軟體包檔案!
我剛剛做了什么以及如何撤消它?我的應用程式似乎仍然可以正常作業,但是如果出現問題,我寧愿現在回滾,也不愿在我最終意識到它們之前進一步下線。如果事情沒有被破壞,我仍然想知道我剛剛做了什么。
uj5u.com熱心網友回復:
您可以簡單地查看源代碼。
public function handle()
{
if (is_file($servicesPath = $this->laravel->getCachedServicesPath())) {
@unlink($servicesPath);
}
if (is_file($packagesPath = $this->laravel->getCachedPackagesPath())) {
@unlink($packagesPath);
}
$this->info('Compiled services and packages files removed!');
}
}
該命令洗掉bootstrap/cache/packages.php服務bootstrap/cache/services.php提供者的快取串列。它們將在下次訪問應用程式時重建。
uj5u.com熱心網友回復:
在有人可以做的不僅僅是閱讀幫助命令之前,一個初步的答案出現了:
雖然:
php artisan clear
...根本沒有在 的檔案中列出artisan(或者至少沒有在 中php artisan list),根據它的輸出,它似乎是以下的別名:
php artisan clear-compiled
這似乎得到了證實php artisan help clear-compiled:
Description:
Remove the compiled class file
Usage:
clear-compiled
盡管該幫助命令并沒有真正清除太多,例如確切編譯的類檔案是什么或它們與任何其他清除命令有什么關系,但我猜該命令的作用類似于:
php artisan view:clear
...根據自己的幫助命令執行以下操作:
Description:
Clear all compiled view files
Usage:
view:clear
基于上述,我只能猜測 runningphp artisan clear與 running 一樣無害php artisan view:clear,因為兩者都旨在清除已編譯的檔案,這些檔案在清除后會在下一次構建時再次重新編譯。
與其他任何明確的命令有什么php artisan clear不同php artisan view:clear以及為什么它需要自己的單獨命令和更容易記住的別名仍然......不清楚。
獎金
To anyone else that arrived here because they find themselves constantly running some variation of the above commands for debugging and troubleshooting, I just learnt about the php artisan optimize:clear command, which runs all of these commands at once:
php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan clear
and returns the following output:
Compiled views cleared!
Application cache cleared!
Route cache cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/422704.html
標籤:
上一篇:播種以使用強制性和隨機資料填充表
