Home >Backend Development >PHP Tutorial >为何命名空间里的use后面没有as

为何命名空间里的use后面没有as

WBOY
WBOYOriginal
2016-06-13 12:10:201046browse

为啥命名空间里的use后面没有as
大家知道命名空间里的use语法规则规定其后面必须跟as起个别名,但是thinkphp官方代码中却没有跟as,这到底是怎么回事呢

------解决思路----------------------
只要命名空间 Think 中存在 Controller 类
那么
use Think\Controller

use Think\Controller as Controller
是等价的

况且你在整个 thinkphp 代码中都不会找到 namespace Think\Controller 这样的命名空间声明

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn