我编写了一个脚本,它使用来自标准PHP库(SPL)的FilterIterator类,我得到了与PHP 5.x版本不同的行为:(这里是accept()函数:
public function accept()
{
$current = $this->current();
print_r($current);
return true;
}
并且继承了PHP 5.3.1的输出:
DirectoryIterator Object
(
[pathName:SplFileInfo:private] => /Users/alex/Sites/dev/php/fscms/content/.
[fileName:SplFileInfo:private] => .
[glob:DirectoryIterator:private] =>
[subPathName:RecursiveDirectoryIterator:private] =>
)
DirectoryIterator Object
(
[pathName:SplFileInfo:private] => /Users/alex/Sites/dev/php/fscms/content/..
[fileName:SplFileInfo:private] => ..
[glob:DirectoryIterator:private] =>
[subPathName:RecursiveDirectoryIterator:private] =>
)
DirectoryIterator Object
(
[pathName:SplFileInfo:private] => /Users/alex/Sites/dev/php/fscms/content/.DS_Store
[fileName:SplFileInfo:private] => .DS_Store
[glob:DirectoryIterator:private] =>
[subPathName:RecursiveDirectoryIterator:private] =>
)
以及我在PHP 5.2.5下使用相同代码得到的内容
DirectoryIterator Object
(
)
DirectoryIterator Object
(
)
DirectoryIterator Object
(
)
后者对所有文件都有权限755。怎么了数据?
答案 0 :(得分:2)
答案 1 :(得分:0)
来自PHP.net:
可能你的PHP 5.2.5配置在某种程度上是不完整/错误的?您是否将错误日志级别设置为显示警告?如果没有,请调整它并再次运行您的代码以查看它是否抛出任何警告......