Php &引用;“连接已重置”;包括文件时
我在使用PHP5.4时遇到了一个问题,这让我绞尽脑汁想了好几个小时,看起来很奇怪 我正在运行一个脚本来加载基于数组中定义的结构的类 代码如下:Php &引用;“连接已重置”;包括文件时,php,server-side-includes,Php,Server Side Includes,我在使用PHP5.4时遇到了一个问题,这让我绞尽脑汁想了好几个小时,看起来很奇怪 我正在运行一个脚本来加载基于数组中定义的结构的类 代码如下: $ds = DIRECTORY_SEPARATOR; $directories = array( 'classes', 'classes/extendedClasses', 'controllers' ); try{ foreach( $directories as $dir ){ $dirPath =
$ds = DIRECTORY_SEPARATOR;
$directories = array(
'classes',
'classes/extendedClasses',
'controllers'
);
try{
foreach( $directories as $dir ){
$dirPath = realpath(__DIR__ . $ds . ".." . $ds . $dir);
if( !$dirPath ){
continue;
}
//var_dump($dirPath, '<br>');
$files = scandir($dirPath);
if( count($files) > 0 ){
foreach( $files as $file ){
if( empty($file) || $file == '.' || $file == '..' || strpos($file, '.php') === false ){
continue;
}
$toInclude = realpath($dirPath . $ds . $file);
if( file_exists($toInclude) ){
include_once($toInclude);
}
}
}
}
}Catch( Exception $ex ){
var_dump('Error in including dependencies');
exit(__METHOD__ . "--" . __LINE__);
}
从代码中,我不再得到错误。有人能提供这样可能发生的情况吗?这是否与我试图在子目录中包含某些内容有关?这对我来说毫无意义
任何帮助都将不胜感激
提前感谢,
路易斯·迪亚斯(Luis Dias)我唯一一次看到这种情况是在使用opcache插件时,如果您启用了它,是否可以尝试禁用它并重试?嗨,谢谢您的评论。我将php_flag opcache.enable Off添加到我的.htaccess文件中,得到了相同的错误。
'classes/extendedClasses',