Home>Article>PHP Framework> The timer in workerman does not take effect
The question leads to:
Put a \Workerman\Lib\Timer in start_gateway.php and execute it every two seconds. Each execution first records a piece of text to text file.
There is no problem when running as php start.php start, but when running as php start.php start -d, it seems that the timer is not running.
start_gateway.php code is as follows
##Problem solution: Business logic must be run in the onXXX callback (emphasized in the manual). In other words, the timer cannot run beforeWorker::runAll();is executed.
The above is the detailed content of The timer in workerman does not take effect. For more information, please follow other related articles on the PHP Chinese website!