Home > Backend Development > PHP Tutorial > Download files in batches

Download files in batches

WBOY
Release: 2016-07-28 08:26:35
Original
1855 people have browsed it

//File download
$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;
?>

The above has introduced the batch downloading of files, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template