2012-12-17 21 views
0

我在文件中的以下代碼spl_autoload_register與其他自動加載衝突的

文件一個有這種

spl_autoload_register(function($class){ 
    $class = str_replace('\\', '/', $class); 
    require_once('' . $class . '.php'); 
}); 

文件中的兩個有這個

require_once('Autoload.php'); 

和文件3被調用文件中的一個和兩個像這樣

include_once('file1.php'); 

//some codes 
include('file2.php') 

現在由於某種原因,當我運行file3.php它給我這個錯誤

未能打開流:需要「Autoload.php」 /家/的public_html /文件夾/在線file1.php失敗開口26

現在我做了一些關於sp1_autoload_register的研究,看起來$ class可能已經在file2中定義了,並且觸發了未找到的錯誤,我懷疑在file2的autoload.php中有另一個sp1_autoload_register,但其中包含的文件有ioncubed 。我如何知道編碼文件中是否有其他sp1_autoload_register函數?

+0

你有在同一個目錄中的文件'Autoload.php'? –

回答

1

這可以檢查任何sp1_autoload_register功能

spl_autoload_register(function($class){ 
$class = str_replace('\\', '/', $class); 
if (stream_resolve_include_path($class)) 
    require_once('' . $class . '.php'); 
}) 
相關問題