>  기사  >  백엔드 개발  >  php base64 转图片的字符编码怎么设置

php base64 转图片的字符编码怎么设置

WBOY
WBOY원래의
2016-06-23 14:04:141021검색

  请问,php base64 的字符编码怎么设置,我现在把一张图片读取后编码是这样 
R0lGODlhFAAUAOZoAPj4+CIiIurq6iEhISAgIFRUVPb29uvr66amplJSUrm5uZ2dnRcXF4SEhBgYGHh4eDg4OC4uLjk5ORQUFEBAQDAwMF1dXRsbG9zc3BoaGh0dHbu7uyUlJX19fX9/f6ioqPr6+ldXV3d3dzExMaqqqkpKSikpKWNjY1BQUG9vb4GBgUFBQZSUlIaGhjw8PPPz8yQkJL29vcDAwBISErW1tYWFha6urpWVlQkJCQQEBCYmJicnJ21tbTU1NUdHR6+vrywsLIODg1lZWWlpaYKCgk9PT/f39/39/bi4uEJCQioqKu/v7z8/P3BwcL6+vvz8/DIyMp6enjc3N2xsbGBgYFpaWrCwsJKSkh4eHg4ODu3t7bGxsby8vExMTI6OjoyMjG5ubpycnM3NzU5OThwcHKenp97e3vn5+f///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAGgALAAAAAAUABQAAAfRgGiCg4SFhoeIiYMxUmcWNYqFNBVnJSKRhBtQZ0JEmIMblCEqn4IKQGcFHolHMiwGpiZnCR2DCB+waAdcXQRLgk4cZ2OrghRKZQdoCygaEWICAh8wZ0VN0QcJGj0LaAU7GRcEAQMEESAnWAMBAWQZAQVoDRIMAx1fV1TCIRQ3LV4QGARogAZDlBETzAB4QuLCGR880LwAIcFBEAyCzoSpkguJAwBJLgl68EBLoi0TAKxIUQqNlRkAmIBp+SMLABdTWiLIYUSHhZY2cACAMKQlpkAAOw==

这是utf8的 但是我想弄成gbk,gb2312的 我试了 header 没用,请问我该怎么做
附上图片


回复讨论(解决方案)

  $thefilename='split.gif';
  $PSize = filesize($thefilename);
  $imgbinary = fread(fopen($thefilename, "rb"), filesize($thefilename));
  $base64=base64_encode ($imgbinary); 
这是我的代码 

图片与字符编码毫无关系

那我怎么得到 其他形式的 base64 编码 

我在c#中写了一个 base64读取的例子 得到的字符串就不一样  

内容不同,base64码值就不同

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.