--lua代码

local http = require "socket.http"
local ltn12 = require("ltn12")
request_body = 'u=1&parameter={"m":"S"}'
local result = http.request{
    url = "http://127.0.0.1/2.php",
    sink = ltn12.sink.file(io.stdout),
    method = "POST",
    headers = {
        ["Content-Type"] = "application/x-www-form-urlencoded",
        ["Content-Length"] = #request_body,
    },
    source = ltn12.source.string(request_body)
}
print (result)


//php测试代码

<?php
    $arr = $_POST ;
    $str =  $arr['parameter'];
    file_put_contents("t.txt", print_r(json_decode($str),1));
    echo $str;

?>