yar

<?php 

class Operator {

    /**
     * 两数相加
     */
    public function add($a, $b) {
        return $this->_add($a, $b);
    }

    /**
     * 两数相减
     */
    public function sub($a, $b) {
        return $a - $b;
    }

    /**
     * 两数乘法
     */
    public function mul($a, $b) {
        return $a * $b;
    }

    /**
     * Protected methods will not be exposed
     * @param interge
     * @return interge
     */
    protected function _add($a, $b) {
        return $a + $b;
    }
}

$server = new Yar_Server(new Operator());
$server->handle();

 

<?php

function callback($retval,$callinfo){
     var_dump($retval);
}



$url="http://192.168.40.218/yar/Operator.php";
//$client = new yar_client($url);

//var_dump($client->add(1, 2));


Yar_Concurrent_Client::call("http://192.168.40.218/yar/Operator.php","add",array(1,6),"callback");
Yar_Concurrent_Client::call("http://192.168.40.218/yar/Operator.php","add",array(1,6),"callback");
Yar_Concurrent_Client::call("http://192.168.40.218/yar/Operator.php","add",array(1,6),"callback");

Yar_Concurrent_Client::loop();//send

 

相关文章:

  • 2021-12-22
  • 2022-01-18
  • 2021-10-04
  • 2021-10-06
  • 2021-11-12
  • 2022-02-04
  • 2022-02-25
  • 2022-02-04
猜你喜欢
  • 2022-01-05
  • 2021-10-06
  • 2021-09-28
  • 2021-06-30
  • 2022-01-18
  • 2021-06-18
  • 2021-08-14
相关资源
相似解决方案