我正在做一个Codeigniter PHP框架的Web应用程序。当用户单击Login Button时,在向用户提供仪表板之前会调用5-6个函数
例如
/*When user clicks login button */
$this->setSession($u_id);
$this->getUserData($u_id);
$this->getUserFriends($u_id);
$this->sendEmail($u_id);
$this->showDashboard($data);现在上述四个功能是独立的,functions..they不会以任何方式相互作用。因此,如果这3个函数以任何顺序执行或并行执行,系统仍将处于一致模式。
那么,如果可能的话,如何让这3个函数在Codeigniter中同时执行呢?
提前感谢
发布于 2013-01-23 21:22:56
PHP不支持后台进程,但请检查此解决方法:http://ellislab.com/forums/viewthread/66539/#327527
function background() {
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
log_message('error', 'Unable to connect to server');
return;
}
$request = "GET /SendSMS/index HTTP/1.1\r\n"
."Host: www.example.com\r\n"
."Connection: Close\r\n\r\n";
fwrite($fp, $request);
fclose($fp);
}https://stackoverflow.com/questions/14480584
复制相似问题