本文整理汇总了PHP中D::test方法的典型用法代码示例。如果您正苦于以下问题:PHP D::test方法的具体用法?PHP D::test怎么用?PHP D::test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类D
的用法示例。
在下文中一共展示了D::test方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main()
{
$c = new C();
B::test($c);
C::test($c);
D::test($c);
}
示例2: main
function main()
{
$d = new D();
$d->test();
$d->test2();
$e = new E();
$e->test();
$e->test2();
}
示例3: foo
<?php
class C
{
private function foo()
{
echo "C::foo\n";
}
public function test()
{
// This should not call C::foo, it should fatal
D::foo();
}
}
class D extends C
{
private function foo()
{
echo "D::foo\n";
}
}
$obj = new D();
$obj->test();
示例4: test
<?php
class A
{
public static function test($x = null)
{
if (!is_null($x)) {
echo "{$x}\n";
}
return get_called_class();
}
}
class B extends A
{
}
class C extends A
{
}
class D extends A
{
}
echo A::test(B::test(C::test(D::test()))) . "\n";
?>
==DONE==
示例5: test
<?php
trait U
{
public function test()
{
echo __CLASS__ . "\n";
$this->foo();
(yield null);
}
}
class D
{
use U;
protected function foo()
{
echo "U::foo\n";
}
}
$obj = new D();
$x = $obj->test();
foreach ($x as $v) {
}
示例6: test
<?php
class C
{
public static function test()
{
D::prot();
print_r(get_class_methods("D"));
}
}
class D extends C
{
protected static function prot()
{
echo "Successfully called D::prot().\n";
}
}
D::test();