不同的框架,略有不同。

首先,在index.php文件中,需要加入。

// 加载vendor,统计服务、RPC Client等.
require __DIR__ . '/../vendor/Bootstrap/Autoloader.php';
\Bootstrap\Autoloader::instance()->addRoot(__DIR__.'/../')->init();

 

其次,在基类里写入代码

WebStatis::setConfig(array('report_address' => C('statistic_address')));
WebStatis::tick('api', MODULE_NAME, ACTION_NAME);

 

最后,配置

 // 统计服务地址
    'statistic_address' => 'udp://127.0.0.1:2006',


完成。这时候就可以使用强大的workerman统计功能了。


相关文章:

  • 2021-07-20
  • 2021-04-26
  • 2023-03-19
  • 2021-06-30
  • 2022-12-23
  • 2021-05-27
  • 2021-09-19
猜你喜欢
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-10-13
  • 2021-11-19
相关资源
相似解决方案