本文整理匯總了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();