1月23

用opendir 和 readdir,读取某目录所有mp3文件名,生成L3X播放器的播放列表

| |
20:38WEB 应用  From: 本站原创
用opendir 和 readdir,读取某目录所有mp3文件名,生成L3X播放器的播放列表,代码如下:


<?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);
}
?>


来源:夕阳醉了's Blog
地址:http://oznn.com/post/89/
转载时须以链接形式注明作者和原始出处及本声明!
阅读(3024) | 评论(0) | 引用(0)
发表评论
表情
emotemotemotemot
emotemotemotemot
emotemotemotemot
emotemotemotemot
emotemotemotemot
emotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]