Yar.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. namespace think\controller;
  12. /**
  13. * ThinkPHP Yar控制器类
  14. */
  15. abstract class Yar
  16. {
  17. /**
  18. * 构造函数
  19. * @access public
  20. */
  21. public function __construct()
  22. {
  23. //控制器初始化
  24. if (method_exists($this, '_initialize')) {
  25. $this->_initialize();
  26. }
  27. //判断扩展是否存在
  28. if (!extension_loaded('yar')) {
  29. throw new \Exception('not support yar');
  30. }
  31. //实例化Yar_Server
  32. $server = new \Yar_Server($this);
  33. // 启动server
  34. $server->handle();
  35. }
  36. /**
  37. * 魔术方法 有不存在的操作的时候执行
  38. * @access public
  39. * @param string $method 方法名
  40. * @param array $args 参数
  41. * @return mixed
  42. */
  43. public function __call($method, $args)
  44. {}
  45. }