Home > Backend Development > PHP Tutorial > 求.mp3资料延时批量重命名实例

求.mp3资料延时批量重命名实例

WBOY
Release: 2016-06-13 10:51:23
Original
1021 people have browsed it

求.mp3文件延时批量重命名实例
网站music目录下有10个不规则文件名的.mp3音乐文件,我想让他们自动重命名,重命名规则为使用1~10的随机数,并且每隔5分钟再次用以上规则重命名,最好可以在后台自动运行,请问该怎样实现?
刚接触PHP,还有诸多问题不懂,希望大家以后能多多帮忙。。

------解决方案--------------------

探讨

简单处理
PHP code

$shuffle_num = range(1, 10);
shuffle($shuffle_num);
foreach (glob('tmp/*.mp3') as $key=>$filename){
$newname = 'tmp/'.$shuffle_num[$key].'.mp3';
rename($filename, $newname);
……

------解决方案--------------------
探讨

引用:

简单处理
PHP code

$shuffle_num = range(1, 10);
shuffle($shuffle_num);
foreach (glob('tmp/*.mp3') as $key=>$filename){
$newname = 'tmp/'.$shuffle_num[$key].'.mp3';
rename($f……
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template