このコードを試してみてください。TODO ステップを 2 つだけ残しました (申し訳ありません! 時間がありません.. 大きすぎてコメントにすることはできません)。完了することができます。このコードを index.php ファイルの先頭に置くと、インクルードが失敗するたびに正しいファイル名が呼び出されます。
ただし、php が返す警告からファイル名を取得するため、個別にテストする必要があります。私のphpバージョンは、括弧内のファイル名を返しますが、あなたのものはわかりません。コードをテストして、その動作を確認します。
<?PHP
/*****************put this at the very top*********************************/
$flag=2;
function correctFileName($incorrectFileName)
{
//directory and file to look at/for
$dirToLookAt = dirname($incorrectFileName);
$fileToLookFor = basename($incorrectFileName);
//get all .php files
$files = array(); $directory = opendir($dirToLookAt );
while($item = readdir($directory))
if(is_string(strstr($item,'.php')))
$files[] = $item;
//to do
/*
loop through the $files array and to
a case insensitive search for $incorrectFileName
if you find one then rename the file you found to $incorrectFileName
then break the loop
*/
}
//error handler function
function customError($errno, $errstr)
{
global $flag;
//find the file name
if($errno==2 and (($flag%2)==0))
{
//this will allow to enter only once per time
$flag++;
//get the file name
$start = strpos($errstr, '(') +1;//7
$length = strpos($errstr, ')') - $start ;//10
correctFileName(substr($errstr, $start ,$length));
}
}
//set error handler
set_error_handler("customError");
/*****************************************************************/
//trigger error
include 'c:\www\home\122221.php';
?>
また、このコードは、ディレクトリの part-name が正しいことを前提としています! それ以外の場合は、それも管理する必要があります。