同级目录下有两个php文件
问题:
我如何在indexb.php中的class c中分别调用index.php中class a 和 class b的静态方法?
namespace 和 use 该怎么填?
文件一:index.php
namespace { use class a{ static public function speak($a) { echo $a; } } } namespace { use class a{ static public function speak($a) { echo $a.$a; } } }
文件二:indexb.php
namespace Php { class c { } }
文件index.php:
文件indexb.php
运行indexb.php 结果I am A!I am B!
是不是你想要的结果?
index.php
indexb.php