-1
別のクラスを拡張するクラスの関数を呼び出します。別のクラスを呼び出す関数
私のクラスの親クラスで関数を呼び出す必要があります。ここに私のコードは次のとおりです。事前に
<?php
class Parents
{
function ParentFun()
{
$name = 'Hello Dear';
}
}
class Child extends Parents
{
function NewTest(){
$extendFun = new Parents;
return $extendFun->ParentFun();
}
}
$result = new Child;
echo $result->NewTest();
おかげ..
http://php.net/manual/en/language。 oop5.php –