批量下载文件
时间:2021-07-01 10:21:17
帮助过:24人阅读
//文件下载
$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++;
}
echo $i;
?>
以上就介绍了 批量下载文件,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。