file.php
$url='http://127.0.0.1/month_ten/base64photo/1.png';//获取图片
$str=file_get_contents($url);
//print_r($str);
$content=base64_encode($str);//将图片转换为16进制格式
//echo $content;
?>
<meta charset="utf-8"/>
<h2>base64</h2>
<form action="get.php" method="post">
<input type="text" name="test" value="<?php echo $content?>"/>
<input type="submit" value="提交"/>
</form>
get.php
header("content-type:text/html;charset=utf-8");
$test=$_POST['test'];
//print_r($test);
$str=str_replace('','+',$test);
$img=base64_decode($str);
file_put_contents('./2.png',$img);