【php】php有沒有請求 restful 介面的類別庫?
ringa_lee
ringa_lee 2017-06-10 09:47:29
0
3
819

之前開發手寫了curl的方法,支援get和post請求

現在要用 put 和 delete 方法,我想找一個專門負責請求的類別庫,不知有沒有?最好能 composer 安裝,謝謝

ringa_lee
ringa_lee

ringa_lee

全部回覆(3)
我想大声告诉你

https://packagist.org/package... 這個

我想大声告诉你

guzzle,requests比較常用

typecho

A proper REST client for php 一直在用這個,還不錯。

<?php

$pest = new Pest('http://example.com');

$thing = $pest->get('/things');

$thing = $pest->post('/things', 
    array(
        'name' => "Foo",
        'colour' => "Red"
    )
);

$thing = $pest->put('/things/15',
    array(
        'colour' => "Blue"
    )
);

$pest->delete('/things/15');

?>
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!