php post json参数的传递和接收处理

页面1 ,php传递json参数的页面:1.php

";
        ob_end_clean();  
  
        $return_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);  
      //  return array($return_code, $return_content);  
	  return  $return_content;
    }  
  
$url  = "http://127.0.0.1/2.php";  
$data = json_encode(array('a'=>"weqweqwe", 'b'=>2));   
  
//list($return_code, $return_content) = http_post_data($url, $data);
$aaa = http_post_data($url, $data);  
//print_r($aaa);
echo $aaa;

$ccc=json_decode($aaa);
print_r($ccc);
echo $ccc->b;

echo "
"; $json = '{"a":1,"b":2,"c":3,"d":4,"e":5}'; var_dump(json_decode($json,true));   ?>

页面2,参数接收处理:

2.php

" 234 ", 'b'=>2));  
echo $data;
?>


你可能感兴趣的:(php学习研究,php,post,json)