public function getConfigAction() { $requestVO = Services_Widget_SetVO::instance()->setRequestGetConfigVO($this->params); if (Services_Widget_SetVO::instance()->checkIfRPC($requestVO)) { $service1 = new Yar_Server(new Services_Widget_Transaction()); $service1->handle(); } else { var_dump(__CLASS__, __FUNCTION__); } }
/** * 架构函数 * @access public */ public function initialize() { if (!extension_loaded('yar')) { die('Not Yar'); } $server = new \Yar_Server($this); $server->handle(); }
public function handle() { try { $service = $this->service(empty($_GET['service']) ? 'NotFoundService' : $_GET['service']); } catch (\Exception $e) { $service = $this->service('NotFoundService'); } $server = new \Yar_Server($service); return $server->handle(); }
/** * 架构函数 * @access public */ public function __construct() { //控制器初始化 if (method_exists($this, '_initialize')) { $this->_initialize(); } //判断扩展是否存在 if (!extension_loaded('yar')) { throw new \Exception('not support yar'); } //实例化Yar_Server $server = new \Yar_Server($this); // 启动server $server->handle(); }
/** * 架构函数 * @access public */ public function __construct() { //控制器初始化 if (method_exists($this, '_initialize')) { $this->_initialize(); } //判断扩展是否存在 if (!extension_loaded('yar')) { E(L('_NOT_SUPPORT_') . ':yar'); } //实例化Yar_Server $server = new \Yar_Server($this); // 启动server $server->handle(); }
<?php $start = microtime(true); ini_set('display_errors', 1); error_reporting(E_ALL); define("APP_PATH", realpath(dirname(__FILE__) . '/../app/')); /* 指向public的上一级 */ require '../vendor/autoload.php'; if (isset($_SERVER['HTTP_USER_AGENT']) && substr($_SERVER['HTTP_USER_AGENT'], 0, 11) === 'PHP Yar Rpc') { require APP_PATH . '/application/Service.php'; $service = new Yar_Server(new Service()); $service->handle(); } else { $app = new Yaf_Application(APP_PATH . "/conf/application.ini"); $params = array(); if (Yaf_Dispatcher::getInstance()->getRequest()->isGet()) { $params = Yaf_Dispatcher::getInstance()->getRequest()->getQuery(); } else { $params = Yaf_Dispatcher::getInstance()->getRequest()->getPost(); } foreach ($params as $key => $value) { Yaf_Dispatcher::getInstance()->getRequest()->setParam($key, $value); } $app->bootstrap()->run(); } $end = microtime(true); $time = ($end - $start) * 1000; // echo "\n<br>".$time.'ms'; // echo number_format($time, 10, '.', ");
public function userAction() { $apiServer = new Yar_Server(new api\User()); $apiServer->handle(); return false; }
public function run() { $rpc = new \Yar_Server(new self()); $rpc->handle(); }
<?php /** * @date 2015-9-13 * @author zhengyin <*****@*****.**> * @blog http://izhengyin.com * */ class Server { public function get() { return __METHOD__; } public function add() { return __METHOD__; } public function update() { return __METHOD__; } public function delete() { return __METHOD__; } } $server = new Yar_Server(new Server()); $server->handle();
public function indexAction() { $server = new Yar_Server(new RedisCluster()); $server->handle(); die; }
public function yarAction() { $server = new Yar_Server(new TestModel()); $server->handle(); return false; }
public function handle($object) { if (!is_object($object)) { if (class_exists($object)) { $object = new $object(); } throw new Exception("[error] the {$object} is not a object!"); } $yar = new \Yar_Server($object); $yar->handle(); }
<?php error_reporting(-1); class Service_Provider { public function __auth($provider, $token) { if (!$provider || $provider !== $token) { return false; } else { return true; } } public function normal($uid, $version = "3.6") { return $version; } } $yar = new Yar_Server(new Service_Provider()); $yar->handle();
public function userAction() { Yaf_Loader::import(LIB_PATH . '/yar/Yar_User.php'); $service = new Yar_Server(new Yar_User()); $service->handle(); }