guzzle不知不觉升级到六,升级以后和原来3.*的时候用法不一样了,看文档也迷糊,找了半天才从文档找到用法:
POST
<code><span>$response</span> = <span>$client</span>->request(<span>'POST'</span>, <span>'http://httpbin.org/post'</span>, [ <span>'form_params'</span> => [ <span>'field_name'</span> => <span>'abc'</span>, <span>'other_field'</span> => <span>'123'</span>, <span>'nested_field'</span> => [ <span>'nested'</span> => <span>'hello'</span> ] ] ]); <span>$result</span> = <span>$response</span>->getBody();</code>
GET
<code><span>$client</span><span>=</span><span>new</span> Client(); <span>$res</span><span>=</span><span>$client</span><span>-></span>request(<span>'GET'</span>, <span>$url</span><span>.</span><span>"?param1=1¶m2=9"</span>); <span>$result</span><span>=</span><span>$res</span><span>-></span>getBody();</code>
讲道理,还是挺方便的。
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });以上就介绍了php 用guzzule 6 发送HTTP请求,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。