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

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

WBOY
WBOYOriginal
2016-06-13 12:53:34789browse

请问在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);
Statement:
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