[英]repeating text after using opendir/readdir functions
为什么发生这种情况对我来说还是个谜。 所以这是代码:
$dir = 'test/';
$de = opendir($dir);
if ($de) {
while (($file = readdir($de)) !== false) {
$path = $dir . $file;
$file_title = 'this text gets repeated three times, each followed by a dot' . $file;
echo $file;
}
} else {
echo "invalid directory";
}
因此,如果$ file = video.mp4和$ file_title ='文件名'。$ file; 它看起来像这样:
'file name.file name.file namevideo.mp4',如果变量前没有字符串,即$ file_title = $ title,则变量前会有三个点,如下所示:... video.mp4
如果有人知道发生了什么,请告诉我。 谢谢。
您会重复文本,因为您的代码包含一个循环。 那就是while
做什么:它反复运行代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.