不 使用任何外部依赖项或库:
$options = array( 'http' => array( 'method' => 'POST', 'content' => json_enpre( $data ), 'header'=> "Content-Type: application/jsonrn" . "Accept: application/jsonrn" ));$context = stream_context_create( $options );$result = file_get_contents( $url, false, $context );$response = json_depre( $result );
$ response 是一个对象。可以像往常一样访问属性,例如 $ response- > …
其中 $ data 是包含 数据 的数组:
$data = array( 'userID' => 'a7664093-502e-4d2b-bf30-25a2b26d6021', 'itemKind' => 0, 'value' => 1, 'description' => 'Boa saudaÁ„o.', 'itemID' => '03e76d0a-8bab-11e0-8250-000c29b481aa');
警告 :如果在php.ini 中将 allow_url_fopen 设置设置为 Off ,则此方法将无效。



