略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Yar_Server::__construct

2024-04-28

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 noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/yar-server.construct.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3