1月23
用opendir 和 readdir,读取某目录所有mp3文件名,生成L3X播放器的播放列表,代码如下:
来源:夕阳醉了's Blog
地址:http://oznn.com/post/89/
转载时须以链接形式注明作者和原始出处及本声明!
<?php
if ($handle = opendir('mp3player/song')) {
$file = readdir($handle);
$file = readdir($handle);
$id = fopen("try.xml","w+");
fputs($id,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
fputs($id,"<mp3>");
$i=1;
while (false !== ($file = readdir($handle))) {
if (substr($file,-3) == "mp3") {
fputs($id,"<I n=\"".$i."\" f=\"mp3player/song/".$file."\" a=\"".$file."\"/>");
$i++;
}
}
fputs($id,"</mp3>");
closedir($handle);
}
?>
if ($handle = opendir('mp3player/song')) {
$file = readdir($handle);
$file = readdir($handle);
$id = fopen("try.xml","w+");
fputs($id,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
fputs($id,"<mp3>");
$i=1;
while (false !== ($file = readdir($handle))) {
if (substr($file,-3) == "mp3") {
fputs($id,"<I n=\"".$i."\" f=\"mp3player/song/".$file."\" a=\"".$file."\"/>");
$i++;
}
}
fputs($id,"</mp3>");
closedir($handle);
}
?>
来源:夕阳醉了's Blog
地址:http://oznn.com/post/89/
转载时须以链接形式注明作者和原始出处及本声明!

为BLOG 添加 音乐播放器 (Lx3 flashmp3pl
三十岁前不要去在乎的29件事 [转]





