示例#1
3
 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__);
     }
 }
示例#2
0
 /**
  * 架构函数
  * @access public
  */
 public function initialize()
 {
     if (!extension_loaded('yar')) {
         die('Not Yar');
     }
     $server = new \Yar_Server($this);
     $server->handle();
 }
示例#3
0
 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();
 }
示例#4
0
 /**
  * 架构函数
  * @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();
 }
示例#5
0
 /**
  * 架构函数
  * @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();
 }
示例#6
0
<?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, '.', ");
示例#7
0
文件: Api.php 项目: weipinglee/nn2
 public function userAction()
 {
     $apiServer = new Yar_Server(new api\User());
     $apiServer->handle();
     return false;
 }
示例#8
0
文件: Rpc.php 项目: tempbottle/zphp
 public function run()
 {
     $rpc = new \Yar_Server(new self());
     $rpc->handle();
 }
示例#9
0
文件: yar.php 项目: weipinglee/nn2
<?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();
示例#10
0
 public function indexAction()
 {
     $server = new Yar_Server(new RedisCluster());
     $server->handle();
     die;
 }
示例#11
0
 public function yarAction()
 {
     $server = new Yar_Server(new TestModel());
     $server->handle();
     return false;
 }
示例#12
0
文件: Base.php 项目: vzina/yaf-api
 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();
 }
示例#13
0
文件: auth.php 项目: liulingfree/yar
<?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();
示例#14
0
文件: YarServer.php 项目: xn1224/YOF
 public function userAction()
 {
     Yaf_Loader::import(LIB_PATH . '/yar/Yar_User.php');
     $service = new Yar_Server(new Yar_User());
     $service->handle();
 }