diff --git a/reference/yar/examples.xml b/reference/yar/examples.xml index f5af04bb4a..775dce316d 100644 --- a/reference/yar/examples.xml +++ b/reference/yar/examples.xml @@ -4,23 +4,118 @@ &reftitle.examples; - Yar Example + Yar Server Example _add($a, $b); + } + + /** + * Sub + */ + public function sub($a, $b) { + return $a - $b; + } + + /** + * Mul + */ + 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; + } +} +?> +]]> + + + + + Access the server in borwser(GET request) + &example.outputs.similar; + + Yar Server Info + + + + + + + + Yar Client Example + +add(1, 2)); + +/* call via call */ +var_dump($client->call("add", array(3, 2))); + + +/* __add can not be called */ +var_dump($client->_add(1, 2)); +?> +]]> + + &example.outputs.similar; + + + + + + + Yar Concurrent Client Example + + ]]> &example.outputs.similar; - + + - - yar.transport - curl - PHP_INI_SYSTEM - - yar.debug Off @@ -37,16 +31,22 @@ yar.connect_timeout - 1 + 1000 PHP_INI_ALL yar.timeout - 5 + 5000 PHP_INI_ALL + + yar.expose_info + On + PHP_INI_SYS + + @@ -63,18 +63,7 @@ - - - - - - - yar.transport - string - - - - + it could be php, json, and msgpack(require built with msgpack support) @@ -96,7 +85,7 @@ - + timeout in ms @@ -107,7 +96,18 @@ - + timeout in ms + + + + + + yar.timeout + bool + + + + whether expose the service info(when access the server via GET)