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