php 下载文件并保存到php中的本地

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 下载文件并保存到php中的本地相关的知识,希望对你有一定的参考价值。

<?php 

$file = "https://s3-us-west-1.amazonaws.com/media.designashirt.com/Fonts/Anton.ttf";


$local_file = 'Anton.ttf';

$handle = fopen($local_file, 'w') or die('Cannot open file:  ' . $local_file);
$data = file_get_contents("https://s3-us-west-1.amazonaws.com/media.designashirt.com/Fonts/Anton.ttf");
fwrite($handle, $data);

fclose($handle);

以上是关于php 下载文件并保存到php中的本地的主要内容,如果未能解决你的问题,请参考以下文章