0
点赞
收藏
分享

微信扫一扫

PHP接收http的post请求

盖码范 2022-01-08 阅读 57
<?php
    $json_params = file_get_contents("php://input");
    $data = json_decode($json_params);
    echo "hello";
    if (strlen($json_params) > 0 )
    {
        echo "yes";  	
        // $myfile = fopen("newfile.txt", "a+") or die("Unable to open file!");
        // fwrite($myfile, $json_params+"\n");
        // //fwrite($myfile, $data['resorce']);
        // fclose($myfile);

        $resorce = $data['resorce'];
        echo($resorce);
        //echo($data);
        echo "over";
    } 
    else 
    {
        echo "could not decode POST body";  
    }   
?>

举报

相关推荐

0 条评论