您好,欢迎访问一九零五行业门户网

namespace和use的使用问题(已附上详细例子)

同级目录下有两个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 { }}

回复内容: 同级目录下有两个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
a); b::speak($this->a); }}$c = new \testt\c();$c->a = 'zhansan';$c->speak();}
其它类似信息

推荐信息