下载并删除文件

下载文件:
$ch = curl_init($musicPathUrl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$dataMp3 = curl_exec($ch);
$fp = fopen($musicPath, ‘w‘);
fwrite($fp, $dataMp3);
fclose($fp);
curl_close($ch);

删除文件:

unlink($musicPath);
 

相关推荐