标签归档:文件

都是换行惹的祸

在使用以下 PHP 代码时遇到了些问题。

# list.txt
/*
    Be More.mp3
    Hello.mp3
    Drift Away.mp3
    Panda Sneeze.mp3
*/
$lines = file("list.txt");
foreach ($lines as $line){
    echo filesize($line);
    // code above get results like following except the last line:
    // Warning: filesize() [function.filesize]: stat failed for songs/Hello.mp3 in ...
    # echo filesize("songs/Hello.mp3");  // this'll be ok
}

继续阅读