标签:需要 span nbsp bsp 注意 格式 code 没有 问题
今天在linux中使用curl发送一个post请求时,带有json的数据,在发送时发现json中的变量没有解析出来
如下
curl -i -X POST -H ‘Content-type‘:‘application/json‘ -d {"BTime":""$btime""} http://api.baidu.com
变量没有做解析
原来在shell中,"" ‘还是有很大区别的,
把修改后的curl发送贴出
atime=`date -d "$1" +%s` btime=`date -d "$2" +%s` curl -i -X POST -H "‘Content-type‘:‘application/json‘" -d ‘{"ATime":"‘$atime‘","BTime":"‘$btime‘"}‘ $url 需要注意的是,json数据里变量要用‘‘括起来
linux shell中curl 发送post请求json格式问题
标签:需要 span nbsp bsp 注意 格式 code 没有 问题
原文地址:http://www.cnblogs.com/landhu/p/7048255.html