扫码关注官方订阅号
以前没设计过API 我想做个JSON的API,直接传递JSON过去,但是好像一定要键值对的方式传递,全文本的话$_POST接收不到东西.一定要键值对方式吗?
ringa_lee
$jsoncode = file_get_contents("php://input");$arr = array();$arr = convertUrlQuery($jsoncode);
$user_id = $arr['user_id']; $info = $arr['info']; $type =$arr['type'];
当然可以。
$data_one = $GLOBALS['HTTP_RAW_POST_DATA']; $data_two = file_get_contents("php://input");
可以用curl测试,核心语句。
curl_setopt($ch, CURLOPT_POSTFIELDS,"我没有名字");
$postdata = file_get_contents("php://input");
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
$jsoncode = file_get_contents("php://input");
$arr = array();
$arr = convertUrlQuery($jsoncode);
当然可以。
可以用curl测试,核心语句。
$postdata = file_get_contents("php://input");