php中require语句的文件路径会导致Apache.exe – 应用程序异常

php中require语句的文件路径会导致Apache.exe – 应用程序错误

被require的文件放在相同目录时用require( ‘1.php ‘);可以正常访问。但是把1.php放在上级目录中用require( ‘../1.php ‘);就会出错,APACHE服务器异常关闭。请问是什么问题啊?

—————————

Apache.exe   –   应用程序错误

—————————

应用程序发生异常   unknown   software   exception   (0xc00000fd),   位置为   0x77f8646f   。

要终止程序,请单击“确定”。

要调试程序,请单击“取消”。

—————————

确定       取消      

—————————


if (!function_exists( ‘bugFixRequirePath ‘))

{

function bugFixRequirePath($newPath)

{

$stringPath = dirname(__FILE__);

if (strstr($stringPath, “: “)) $stringExplode = “\\ “;

else $stringExplode = “/ “;

$paths = explode($stringExplode,$stringPath);

$newPaths = explode( “/ “,$newPath);

if (count($newPaths) > 0)

{

for($i=0;$i <count($newPaths);$i++)

{

if ($newPaths[$i] == “.. “) array_pop($paths);

}

for($i=0;$i <count($newPaths);$i++)

{

if ($newPaths[$i] == “.. “) unset($newPaths[$i]);

}

reset($newPaths);

$stringNewPath = implode($stringExplode,$paths).

$stringExplode.implode($stringExplode,$newPaths);

return $stringNewPath;

}

}

}

require(bugFixRequirePath( “../1.php “));

搂住看看这个。

好像是有这个bug,php官方站点上有sample,4.1以后好像没这个问题,我这边没发现有什么问题

php中require语句的文件路径会导致Apache.exe – 应用程序异常

相关文章:

你感兴趣的文章:

标签云: