如何多线程使用codeigniter famework(PHP)? [英] How to multi-thread using codeigniter famework(PHP)?
问题描述
我使用codeigniter框架。我正在寻找一个最佳实践多线程使用MVC框架的codeigniter。
I am using codeigniter framework. And i am searching for a best practice to multi-thread using MVC framework of codeigniter.
我想创建一个类,其中所有的函数将被写入运行
I am thinking of creating a class in which all the functions will be written to run in a different independent thread.
请使用codeigniter的MVC框架向多线程建议我的技巧。
Please suggest me techniques to multi thread using codeigniter's MVC framework.
推荐答案
您不能直接使用PHP进行 do 多线程。每个页面加载由单个线程处理。
You can't do multi-threading directly with PHP. Every page load is handled by a single thread.
如果您希望 function foo()
的值传递到函数bar ()
但是在多线程的方式,你可以模拟它与作业队列像Resque或RabbitMQ。
If you want the value of function foo()
to be passed to function bar()
but in a multi-threaded kind of way, you could emulate it with a job queue like Resque or RabbitMQ.
但是说你想要多线程PHP就像说你想要一辆有四个轮子的摩托车。
But saying you want multi-threaded PHP is like saying you want a motorbike with four wheels.
这篇关于如何多线程使用codeigniter famework(PHP)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!