将以下脚本文件加入crontab,即可实现定时生成新文件。脚本的原理主要是使用dd指令创建指定大小的文件。 ?php $timestamp = time(); $id = uniqid(); $filename = "/tmp/{$timestamp}.img"; $cmd = "dd if=/dev/
<?php $timestamp = time(); $id = uniqid(); $filename = "/tmp/{$timestamp}.img"; $cmd = "dd if=/dev/zero of=$filename bs=4m count=5; echo $id >> {$filename}"; exec($cmd, $ret, $output); ?>