Home > Backend Development > PHP Tutorial > 请教在php里, 从mysql读到的图片, 要如何存成本地的pic呢

请教在php里, 从mysql读到的图片, 要如何存成本地的pic呢

WBOY
Release: 2016-06-13 11:15:06
Original
973 people have browsed it

请问在php里, 从mysql读到的图片, 要怎么存成本地的pic呢?
mysql里我是把jpg图片用mediablob的格式存的.

显示我可以用:
  $showidxnumber=$_GET["idx_num"];
  $result=mysql_query("SELECT * FROM ecard WHERE picidx=$showidxnumber");
  $row=mysql_fetch_object($result);
  echo $row->picdata;   

但目前有个新的需求, 要把pic存到本地, 比如把它save成c:\a.jpg  ,要怎么写code呢? 请教一下大家, 谢谢了.

php mysql
------解决方案--------------------
file_put_contents('c:\a.jpg', $row->picdata);
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