Ben uzatmak gereken bir proje var. Bütün sınıflar ayrı dosyalarda, diğer dosyalarda mevcut kodu yeniden yazmadan bazı sınıfların genişletmek için ihtiyaç vardır. Benim fikrim ad kullanmak oldu ama başarısız. İşte bir örnek:
Ben orijinal A.php class dosyası yeniden adlandırıldı ettik A_Original.php:
class A
{
public function hello()
{
echo "hello world from Class A\n";
}
}
Sonra oluşturulan yeni bir A.php:
namespace AOriginal {
include 'A_Original.php';
}
namespace {
class A
{
public function hello()
{
echo "hello world from Class A Extended\n";
}
}
}
This fails because on including
the original A_Original.php file the class is dumped to the global scope (thus ignoring the namespace command).
I can not modify the existing code inthe A_Original.php file, but renaming is ok.
Diğer proje dosyaları (I değiştiremezsiniz hangi) bir require "A.php"
kullanın.
Bunu gerçekleştirmek için?