The platform will provide a new template for PHP, named tars.tarsphp.default, !!!!!!! You must first modify the PHP execution path !!!!!!! Template related modifications: a. Create a new tars.tarsphp.timer service template, compared to tars.tarsphp.default and add an isTimer = 1. The PHP service selects the tars.tarsphp.timer template. b. Or use the tars.tarsphp.default template and add the following to the private template under the editing service:
<tars>
<application>
<server>
isTimer=1
</server>
</application>
</tars>
Enter Operations Management => Deployment Services on the platform, fill in the corresponding application name and service name, note: that this is the same as tars.proto.php in the tars folder below Need to be completely consistent.
Select the service type as tars_php
Select the template as the timer service template just created, set is not enabled by default
Select an available port and fill in the server's intranet IP
The port type is TCP !!!! Protocol type TIMER service must choose non-TARS !!!!!!
The number of threads corresponds to the number of SWOOLE processes, that is, the number of timer services that can be started under the timer directory
The maximum number of connections, the maximum queue length, and the queue timeout period are not effective for the PHP service.
Click Add and Submit, then please enter the development guidline
<?php
namespace TimerServer\timer;
class TenSecondsTimer {
public $interval;
public function __construct()
{
$this->interval = 10000; //Unit is millisecond
}
public function execute() {
// Your business code
}
}
<?php
return array(
'appName' => 'PHPTest',
'serverName' => 'PHPTimerServer',
'objName' => 'obj',
);
This name must correspond exactly to the name on the tars platform.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。