PHP OOPの新人です。別のクラスのあるクラスのメンバーデータと関数にアクセスしたいという問題があります。私はそれをグーグルだが、完璧な解決策を得ていない。私はここに新しいですPHPの他のクラスのあるクラスの関数とデータにアクセスする方法
class school{
public function teacher()
{
$teacher_name='Ali Raza';
}
public static function students()
{
echo"STUDENT DATA: Jhon Deo";
}
}
class library{
public function teacher_name()
{
// Now here i want to acces the name of teacher form above class function teacher.
}
public function student_name()
{
// Now here i want to access the member function(students) from school class.
}
}
:
はここに私のコード例です。前もって感謝します。
に役立ちます。 –
基本的な知識が必要なので、最初に理論をお読みください(http://php.net/manual/en/language.oop5.php) – Neodan