namespace Ens\NewBundle\Controller;
use Ens\NewBundle\Entity\Product;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\FormBuilder;
require '/var/www/predis/autoload.php';
\Predis\Autoloader::register();
require_once('Services/Notification.php');
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
启动时执行的功能。
public function indexAction()
{
$x=array('to'=>'ucerturohit@gmail.com','name'=>'Rohitashv singhal');
$client = new \Predis\Client();
//$client->lpush('email','ucerturohit@gmail.com');
//$u=$client->blpop('emailnew',0);
//var_dump($u);
$product=new Product();
$product->setName('rohit');
$product->setPass('rohit');
$form=$this->createFormBuilder($product)
->add('name','text')
->add('pass','password')
->getForm();
$z=notification_on_signup($x);
if($z)
$name='success';
else
$name='failed';
return $this->render('EnsNewBundle:Email:ind.html.twig',
array('form'=>$form->createView(),'name'=>'rohit'));
}
}
这里的notification_on_signup函数是在发送邮件的另一个函数中定义的。当我点击提交按钮然后我再次调用相同的功能。我想要的是,当我提交表单时,表单应该首先出现,电子邮件函数notification_on_signup
应该在后台运行。我应该如何使用redis在后台发送功能。请帮忙
答案 0 :(得分:0)
如果我理解你的问题,我认为这与redis没有任何关系。相反,您必须使用诸如gearman
之类的作业服务器答案 1 :(得分:0)
也许这会对你有所帮助: php-resque是一个Redis支持的PHP库,用于创建后台作业,将它们放在多个队列中,并在以后处理它们。