nasıl php __ Çocuk sınıfın DIR__

0 Cevap php

Ben ayrı klasörlerde iki sınıfları var

class Parent
{
    public $path = null;

    function  __construct()
    {
        $this->path = __DIR__;
    }
}

ve

class Child extends Parent
{

}

Yani Çocuk bir örneğini oluşturduğunuzda:

$child = new Child();
echo $child->path

Ben Veli bir yol olsun. Ne ben aslında istiyorum Çocuk yolunu elde etmektir. Ben Çocuk sınıf değiştiremezsiniz.

Bu mümkün mü?

0 Cevap