久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php怎么將圖片轉(zhuǎn)二進(jìn)制字符串?

      php將圖片轉(zhuǎn)二進(jìn)制字符串的方法:首先使用filesize()獲取圖片文件的大小,賦值給變量$PSize;然后使用fopen()打開圖片文件,賦值給變量$fp;最后使用“fread($fp,$PSize)”讀取文件,轉(zhuǎn)換為二進(jìn)制字符串?dāng)?shù)據(jù)。

      php怎么將圖片轉(zhuǎn)二進(jìn)制字符串?

      php將圖片文件轉(zhuǎn)換成二進(jìn)制輸出的方法

      header( "Content-type: image/jpeg"); $PSize = filesize('1.jpg'); $fp =fopen('1.jpg', "rb"); $picturedata = fread($fp, $PSize);//二進(jìn)制數(shù)據(jù) echo $picturedata;

      就這么簡單5行代碼,就將圖片以二進(jìn)制流的形式輸出到客戶端了,和打開一張圖片沒有任何區(qū)別。

      這里需要注意的是,發(fā)送的header要根據(jù)具體情況而定,不一定都是image/jpeg。JPG的就是image/jpeg,但PNG的就是image/png.不同類型的圖片輸出不同的頭部。

      推薦:《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)