//檔案下載
$host = $config['DB_HOST'];
$port = $config['DB_PORT'];
$user = $config['DB_USER' ];
$pwd = $config['DB_PWD'];
$conn = @ mysql_connect($host.":".$port, $user, $pwd) or die("{'status': 0,'msg':'Database connection error'}");
if($dbc $conn)){
}else{
echo("Could not connect to mysql");
}
$sql = "SELECT link FROM `frame` where cid=1";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
$imagesURL = $row['link'];
file_put_contents(basename($imagesURL), file_get_contents($imagesURL));
$i++;
}
}}?> 以上就介紹了 批量下載文件,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。