## 命名空間調整
如果你自定義了應用類庫的命名空間,需要改為設置環境變量`app_namespace`而不是應用配置文件。
如果你的應用類庫中使用了下面的系統類庫(主要涉及的類庫是5.0靜態調用的系統類庫),那么命名空間需要調整如下:
|5.0系統|5.1系統|
|---|---|
| think\App | think\facade\App (或者 App )|
| think\Cache | think\facade\Cache (或者 Cache )|
| think\Config | think\facade\Config (或者 Config )|
| think\Cookie | think\facade\Cookie (或者 Cookie )|
| think\Debug | think\facade\Debug (或者 Debug )|
| think\Env | think\facade\Env (或者 Env )|
| think\Hook | think\facade\Hook (或者 Hook )|
| think\Lang | think\facade\Lang (或者 Lang )|
| think\Log | think\facade\Log (或者 Log )|
| think\Request | think\facade\Request (或者 Request )|
| think\Response | think\facade\Reponse (或者 Reponse )|
| think\Route | think\facade\Route (或者 Route )|
| think\Session | think\facade\Session (或者 Session )|
| think\Url | think\facade\Url (或者 Url )|
| think\View | think\facade\View (或者 View )|
>[danger] 如果只是用于依賴注入則無需更改命名空間。
舉個例子,如果應用類庫開頭`use`了 `think\Url`
~~~
use think\Url;
Url::build('index/index');
~~~
則需要改成
~~~
use think\facade\Url;
Url::build('index/index');
~~~
或者
~~~
use Url;
Url::build('index/index');
~~~
> 5.1為系統的類庫注冊了類庫別名,因此可以直接從根命名空間方式調用Url。
所以路由配置文件中你可以直接刪除下面的一行代碼
~~~
use think\Route;
~~~