Blogger Information
Blog 14
fans 0
comment 0
visits 8793
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
命名空间的相关知识
于星辉
Original
497 people have browsed it

一、命名空间
namespace 需要写在脚本的顶部 必须是php的第一条指令(除了declare指令)
格式一:
namespace ns1;
格式二:
namespace ns1{}
二、全局空间
namespace{}
三、use
use 在命名空间中的作用

  1. use 引入别的命名空间到当前空间 as 为引过来的命名空间起别名
  2. use 引入别的命名空间中的类到当前空间 as 为引过来的命名空间中的类起别名
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post