我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

覆盖特定类的PHP命名空间

If I have a PHP namespace as follows:

<?php

   namespace A\B;

   $test = new MyClass(); 

it seems every time I create a new instance of class, the name is prefixed with the namespace, e.g.

$test = new A\B\MyClass();

What happens if I don't want to use a namespace for another class, e.g. I want to call

$test = C\D\AnotherClass();

Currently this becomes:

$test = A\B\C\D\AnotherClass();

which results in an error.

近期文章

  • 用PHP处理Android中的数组POST
  • 我无法删除字符串中的一系列单词
  • Utf8_bin和大写/小写搜索结果
  • 网站因入门流程过多而崩溃
  • 如何将多个数据从视图发布到控制器?
  • PHP MAILER向一个收件人发送多封电子邮件
  • 在谷歌图片中获取所选图像图像网址
  • 下拉列表不适用于data-native-menu =“false”
  • php搜索脚本仅提取第一个条件
  • MySQL:选择最后N行,而SUM less则编号
  • 使用谷歌搜索API的不同数量的结果
  • 如何使用php获取所选文本框值的值
  • 如何在extbase插件中插入外部API
  • Mediawiki自定义搜索引擎:查询期间与MySQL服务器的连接丢失
  • $ this with $ row PHP
  • 用ajax在javascript中的php代码
  • Bootstrap在localhost上完美运行但不在VPS上运行
  • 高级搜索选项在gridview中不起作用(使用YII框架)
  • 通过Curl登录9gag并提升一些主题
  • add_role和set_role将角色应用于用户

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华