PHP ThinkPHP 命名空间引入(use )
2022-11-24 11:10:29
154
{{single.collect_count}}



<?php//引入机制-空间引入namespace beijing\haidian\xisanqi;const USER = "root";namespace liaoning\shenyang\tiexi;const USER = "admin";function getSubject(){echo "Java";}namespace shandong\qingdao\laoshan;const USER = "bob";//其他空间元素需要被频繁访问,降低复杂度,设置空间引入use liaoning\shenyang\tiexi;//引入相关的命名空间//访问引入空间的元素-需要通过“限定名称”方式访问//限定名称:就是引入空间的最后一级空间(上述情况就是tiexi)echo tiexi\USER;//admintiexi\getSubject(); //Javaecho USER;//bob当前空间元素


回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}