0
点赞
收藏
分享

微信扫一扫

PHP 文件获取到数组 yahoo 音乐

醉东枫 2023-05-10 阅读 46


 

==>index.php

==>mp3s

          ==>file1

          ==>file2

          ==>file3

<?php

$dir = 'mp3s';

$handle = opendir($dir);
$mp3s = array();
while($file = readdir($handle))
{
if($file != '.' && $file != '..')
$mp3s[] = $file;
}
closedir($handle);
echo "<pre>";
print_r($mp3s);

?>

yahoo media player

index.php

<?php

$dir = 'mp3s';

$handle = opendir($dir);
$mp3s = array();
while($file = readdir($handle))
{
if($file != '.' && $file != '..')
$mp3s[] = $file;
}
closedir($handle);

?>

<html>
<head>
<script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script>
</head>
<body>

<?php

foreach($mp3s as $key => $value)
{
echo "<a href=\"$dir/$value\">" . $value . '</a><br />';
}

?>

</body>
</html>

 

举报

相关推荐

0 条评论