Hprose for php 快速入門(二)

2021-09-11 07:46:54 字數 1172 閱讀 3108

1. 客戶端(client)**(記得該引入的檔案記得引入,我這邊是用yii框架且composer安裝hprose,會自動載入所以沒有寫引入的**)

public function actionhprose()

成功的標誌:如圖所示

2. 服務端(server)**(如用框架,得將csrf,七七八八驗證關掉,不然客戶端不能成功訪問)

①簡單的函式

//函式一

function hello()

//函式二

function foo($name)

//函式三

function thirdfoo()

$server->addfunctions(array('hello', 'foo'));//同時發布兩個函式

$server->addfunction('thirdfoo');//發布乙個函式

$server->start();

成功的標誌(如圖所示):

②類的靜態函式和物件例項的方法

//類的靜態方法和物件例項的方法

class hprosetest

function hello()

};$server->addmethod('foo1', 'hprosetest');

$server->addmethod('hello', new hprosetest());

$server->start();

成功的標誌(如圖所示):

Hprose for PHP型別對映

b size xx large 基本型別 size b b size x large 值型別 size b table 型別 描述 整型 hprose中的整型為32位有符號整型數,表示範圍是 2147483648 2147483647 231 231 1 長整型 hprose中的長整型為有符號無限長...

Boost Graph Library 快速入門

boost graph library 快速入門 by 燕飛龍 南亮亮 採用boost中的鄰接鍊錶 adjacency list 實現圖的定義 下面是乙個鄰接鍊錶定義的例子 include 首先定義圖中節點和邊的屬性 struct vertexproperty structedgeproperty ...

Expression Blend 介面快速入門

在開始使用blend前,首先需要進行silverlight的開發環境搭建,在銀光中國網 silverlightchina.net 有篇 輕鬆建立silverlight開發環境 其中列出了建立silverlight開發環境的幾個步驟,另外,我在過去發布過一篇 silverlight開發工具集合 文章,...