App.class.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2009 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. /**
  12. * ThinkPHP AMF模式应用程序类
  13. */
  14. class App {
  15. /**
  16. * 应用程序初始化
  17. * @access public
  18. * @return void
  19. */
  20. static public function run() {
  21. //导入类库
  22. Vendor('phpRPC.phprpc_server');
  23. //实例化phprpc
  24. $server = new PHPRPC_Server();
  25. $actions = explode(',',C('APP_PHPRPC_ACTIONS'));
  26. foreach ($actions as $action){
  27. //$server -> setClass($action.'Action');
  28. $temp = $action.'Action';
  29. $methods = get_class_methods($temp);
  30. $server->add($methods,new $temp);
  31. }
  32. if(APP_DEBUG) {
  33. $server->setDebugMode(true);
  34. }
  35. $server->setEnableGZIP(true);
  36. $server->start();
  37. //C('PHPRPC_COMMENT',$server->comment());
  38. echo $server->comment();
  39. // 保存日志记录
  40. if(C('LOG_RECORD')) Log::save();
  41. return ;
  42. }
  43. };