RabbitMQ是什么?官方的说明如下:
更详细的介绍及安装信息可以在RabbitMQ官网上获取:
http://www.rabbitmq.com
http://www.php.net/amqp
function msg_queue(){ $this->begin(); //step1.实例会队列,该类会根据配置信息选择使用的是哪种队列系统。 $queue = new base_queue(); $member_obj = $this->app->model('members'); $aMember = json_decode($_POST['arrMember']); unset($_POST['arrMember']); foreach($aMember as $key=>$val){ $member_sdf = $member_obj->dump($val,'*',array(':account@pam'=>array('login_name'))); $login_name = $member_sdf['pam_account']['login_name']; //step2.构造消息,因为要和系统默认的mysql队列兼容,所以按mysq队列的格式传递 $data = array( 'queue_title'=>app::get('b2c')->_('发站内信'), 'start_time'=>time(), 'params'=>array( 'member_id'=>$val, 'data' =>$_POST, 'name' => $login_name, ), //step3.自定义的消费者(worker) 'worker' => 'b2c_queue.send_msg', ); //step4.发布消息 if(!$queue->publish($data)){ $this->end(false,app::get('b2c')->_('操作失败!')); } } $this->end(true,app::get('b2c')->_('操作成功!')); }