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();

  

 

posted @ 2019-08-09 17:14  码农编程进阶笔记  阅读(44)  评论(0编辑  收藏  举报
返回顶部 有事您Q我