$content = file_get_contents("php://input");
$imgName = time();
$file_dir="images/".$imgName.".jpg";
if($fp = fopen($file_dir,'w')){
if(fwrite($fp,$content)){
fclose($fp);
}
}
thinkphp实例
public function saveAvatar(){
$filename = intval($_GET['id']).'.jpg';
$xm
if(emptyempty($xm
$xm
}
if(!$xm
exit( '没有接收到数据流.' );
}
$jpg = $xm
$file = fopen("./Public/Uploads/AVATAR/".$filename,"w");//打开文件准备写入
fwrite($file,$jpg);//写入
fclose($file);//关闭
}
交流QQ:243002768
IT精英交流群:36468081
招聘phper 前端
联系微信:wahha6616
