$data = http_build_query($data); //数组拼接
$data = urldecode($data); //转译的变回原本的
$options = [ //设置格式
'http' => [
'method' => 'POST',
'header' => 'Content-type:application/x-www-form-urlencoded',
'content'=> $data,
'timeout'=> 100
]
];
$context = stream_context_create($options); //对资源流、数据包或者上下文设置参数
return file_get_contents($url,false,$context); //发出请求并返回数据
php中post传值
最新推荐文章于 2022-12-03 23:12:27 发布