file_put_contents 和php://input 實現存儲數據進圖片中


<?php

/**
 *Recieve p_w_picpath data
 **/
error_reporting(E_ALL);

function get_contents()
{
    $xmlstr = file_get_contents("php://input");
    $filename = time() . '.png';
    if (file_put_contents($filename, $xmlstr)) {//將數據存儲進圖片格式中
        echo 'success';
    } else {
        echo 'failed';
    }
}

//get_contents();

var_dump(file_get_contents('1565341389.png'));  //讀取圖片,獲取圖片中的數據

die();

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM