php hessian詳細介紹_PHP教程

來源:互聯網
上載者:User
hessian是什嗎?
看到這個單詞我還不知道怎麼讀,音標是[hes]讀黑森。
hessian是一個輕量級的遠端資料交換工具,使用簡單的方法提供了rmi(遠程方法調用)的功能. 相比webservice,hessian更簡單、快捷。採用的是二進位rpc協議,因為採用的是二進位協議,所以它很適合於發送位元據
hessian是獨立於語言的。
二、在php教程中怎麼用的呢?
你是不是認為這個和soap一樣在php.ini中開啟一個就可以使用了,我也這麼認為的。可
是我要告訴你的是這樣的想法是錯誤的。
需要去下載一個hessianphp的庫來使用。
下載地址http://hessianphp.sourceforge.net/
三、看看怎麼使用。
1、伺服器端。
複製代碼 代碼如下:
include_once('hessianphp/dist/hessianservice.php');
class helloworldservice
{
public function __construct()
{
}
public function add($a, $b)
{
return $a+$b;
}
}
$wrapper = new hessianservice();
$wrapper->registerobject(new helloworldservice);
$wrapper->displayinfo = true;
$wrapper->service();
?>

伺服器端結果

2、用戶端
複製代碼 代碼如下:
require_once 'hessianphp/dist/hessianclient.php';
hessian::errorreporting(hessian_silent);
$url = 'http://localhost/info.php';
$proxy = & new hessianclient($url);
$sum = $proxy->add(3, 5);
echo $sum;
if(hessian::error()) {
$errors = hessian::error();
print_r($erros->message);
//var_dump($errors);
}
?>

client結果

http://www.bkjia.com/PHPjc/629851.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/629851.htmlTechArticlehessian是什嗎? 看到這個單詞我還不知道怎麼讀,音標是[hes]讀黑森。 hessian是一個輕量級的遠端資料交換工具,使用簡單的方法提供了...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.