讓我們假設我想自動加載類,到目前爲止這是正常的。現在,讓我們假設我們處於「測試」環境。我想要加載其他類,而這些類與其他類一樣,但有一些修改。所以,最初就是自動加載爲「模擬」類在php
class A
{
public function method()
{
return rand(1,10);
}
$a = new A(); // in the meantime autoloader finds and load class A
$a->method();
什麼,我想:
class Adev
{
public function method()
{
something::log ('method running');
return rand(1,10);
}
}
$a = new A(); // and then I dont need "A" class but "Adev"
$a->method();
所以有點「重命名」方法應該是用來代替重構代碼。
你最終可以做一些勾選功能來分析回溯? – bwoebi 2013-04-27 15:43:36