CakeFest 2024: The Official CakePHP Conference

Yar_Server::__construct

(PECL yar >= 1.0.0)

Yar_Server::__construct注册 HTTP RPC Server

说明

final public Yar_Server::__construct(Object $obj)

创建一个 Yar 的 HTTP RPC 服务,参数 $obj 对象的所有公开方法都会被注册为服务函数, 可以被 RPC 调用。

参数

obj

一个对象实例, 这个对象的所有公开方法都会被注册为服务函数.

返回值

返回一个 Yar_Server 的实例。

示例

示例 #1 Yar_Server::__construct() 示例

<?php
class API {
/**
* the doc info will be generated automatically into service info page.
* @params
* @return
*/
public function some_method($parameter, $option = "foo") {
return
"some_method";
}

protected function
client_can_not_see() {
}
}

$service = new Yar_Server(new API());
$service->handle();
?>

以上示例的输出类似于:


参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top