发送JSON到服务端 JAVA里面可以不用设置POST的key值 直接发送JSON字符串即可 可PHP里面怎么直接发送JSON格式呢? 
header头 php application应该怎么写呢?

解决方案 »

  1.   

    不是啊 我看了他们JAVA 的写的Content-Type: application/json  直接把JSON写入就可以了 我们PHP我不清楚怎么没有KEY 写入JSON
      

  2.   

    部分加*
    <?php
    define('ROOT', dirname(__FILE__));
    require_once(ROOT.'/note.class.php');
    require_once(ROOT.'/function.func.php');/**************************/
    $SmsServer = 'http://****/sag/smsJsonService';$SendData = array(
    'action'=>'sendSms',
    'body'=>array(
    'productId'=>'service0001',
    'password'=>'ab**efg',
    'spId'=>'32432**3',
    'address'=>'136**7719',
    'message'=>'发送短消息内容'
    ));
    $SendJson = customJsonEncode($SendData);
    $Result = doPost($SmsServer,  array('这里键写什么呢'=>$SendData), '', 17081);
    print_r($Result);
    ?>
      

  3.   

    Content-Type: application/json
    不就是声明一个数据类型的头吗?
    只要对方能认得这个头就行了
      

  4.   

    header("Content-Type:application/json");或者header("Content-Type:application/javascript");