php使用file_get_contents和file_put_contents 如何实现保存文件 文件名不变

WBOY
Release: 2016-06-13 12:26:58
Original
1335 people have browsed it

php使用file_get_contents和file_put_contents 怎么实现保存文件 文件名不变
php使用file_get_contents和file_put_contents 怎么实现保存文件时 保存的文件名与上传过来时的文件一样 即上传1.jpg 保存的就是1.jpg怎么实现
------解决思路----------------------
用$content = file_get_contents($filename)获取到内容,file_put_contents($filename, $content)不就可以吗
------解决思路----------------------

<br />$url = 'http://www.xxx.com/1.jpg';<br />$file = basename($url);<br />$data = file_get_contents($url);<br />file_put_contents($file, $data, true);<br />
Copy after login

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