Using PHP ev class (EvTimer)

半世苍凉 提交于 2020-05-09 10:57:31

问题


Im trying to use EvTimer class, part of PHP ev class. I have already installed ev using pecl on my linux machine and it is visible in phpinfo().

I would like to run this sample:

// Create and start timer firing after 2 seconds
$w1 = new EvTimer(2, 0, function () {
  echo "2 seconds elapsed\n";
});
Ev::run();

But even though i have ev extension installed and enabled, i receive not found error:

PHP Fatal error: Class 'EvTimer' not found in /bin/test.php on line 4

Anyone know why it doesnt see the class? Do i have to include it? From where?


回答1:


PHP Ev Class is PECL extension and not bundled with PHP.

Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » http://pecl.php.net/package/ev .

another case , open your server php.ini and search for Ev extension and enable it if exists.



来源:https://stackoverflow.com/questions/25549864/using-php-ev-class-evtimer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!