性能优化是一个系统性工程,本课程从讲解 Laravel 项目的优化技巧出发,不仅讲解 Laravel 专属的性能优化技巧,还发散讲解到 PHP、 MySQL、缓存系统、前端加载等话题。
性能优化同时又是个持续优化的过程,我们希望通过这里涉及的话题,可以作为你的项目优化的引子,带你打开持续优化的大门。
$ php artisan config:cache
<?php
.
.
.
class RouteServiceProvider extends ServiceProvider
{
.
.
.
public function boot()
{
// 先设置好控制器命名空间
$this->setRootControllerNamespace();
// 1. 如有缓存直接加载
if ($this->routesAreCached()) {
$this->loadCachedRoutes();
// 2. 否则解析路由
} else {
$this->loadRoutes();
$this->app->booted(function () {
$this->app[‘router‘]->getRoutes()->refreshNameLookups();
$this->app[‘router‘]->getRoutes()->refreshActionLookups();
});
}
}
.
.
.
}
原文:https://www.cnblogs.com/itspcool/p/12497289.html