我有这个:
$number = 1;
$mp3 = file_get_contents("http://example.com/text=".$value);
$file = md5($value)."-".$number.".mp3";
file_put_contents($file, $mp3);
$number++;
结果:创建abcdef-1.mp3, abcdef-2.mp3, abcdef-3.mp3.
现在我想abcdef-1.mp3结合abcdef-2.mp3and abcdef-3.mp3。
这有效:
file_put_contents('abcdef.mp3',
file_get_contents('abcdef-1.mp3') .
file_get_contents('abcdef-2.mp3') .
file_get_contents('abcdef-3.mp3'));
但不适合我的代码,因为abcdef不同。数也。
我试过了:
$number = 1;
$mp3 = file_get_contents("http://example.com/text=".$value);
$file = md5($value)."-".$number.".mp3";
file_put_contents($file, $mp3);
file_put_contents(md5($value).".mp3", file_get_contents($file));
$number++;
结果:创建abcdef-1.mp3, abcdef-2.mp3,但是当我玩的时候abcdef-3.mp3只有. 问题出在哪里?abcdef.mp3abcdef-1.mp3