在php中运行多个函数 [英] Running multiple functions in php
本文介绍了在php中运行多个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要同时运行多个函数.我通过创建一个 ElapsedEventHandler 并在计时器结束时执行它,在 C# 中成功实现了它.通过这种方式,我可以同时运行多个功能(委托).我如何使用 php 做同样的事情?
I need to run several functions at the same time. I had successfully implemented in C# by creating an ElapsedEventHandler and executing it when a timer gets elapsed. In this way I could run a number of functions at the same time (delegates). How can I do the same thing using php?
推荐答案
更新
PHP 现在支持多任务处理.请参阅pthreads API.
PHP 没有多线程.因此,您必须通过 CLI 生成另一个 php 进程并运行该脚本.
PHP does not have multi-threading. So you'd have to spawn another php process through CLI and run that script.
查看这些问题了解更多信息:
checkout these questions for more info:
这篇关于在php中运行多个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文