不知道如何处理redis和php


not getting how to deal with redis and php

我已经完成了redis和php的教程。我目前正在使用predis。我有三个名为form.phpsubmit.phpmail.php的文件。在form.php中,我有一个简单的形式。在submit.php中,我写了一个显示内容的简单代码。以及在CCD_ 6中。我已经写了一些发送邮件的代码。当我在form.php中提交表单时,它应该在submit.php中进行。并且CCD_ 9应当在后台开始。我写了一些这样的东西:

submit.php

      $client = new 'Predis'Client();
  $client->select(4);
      $client->lpush('xxxx',$x['to']);
 $arrOutput=shell_exec('php mail.php');
    print_r($arrOutput);

mail.php

  require '/var/www/predis/autoload.php';
        'Predis'Autoloader::register();
echo "hi";
require_once('Services/Notification.php');
$client = new 'Predis'Client();
      $client->select(4);
$u=$client->blpop('xxxx',0);
var_dump($u);
notification_on_signup($u[1]);

那么请告诉我应该如何配置这个东西。这样我就可以在bakground 中发送mail.php

你可以很容易地实现你想要的。在大多数现代JS框架中,您不仅可以向服务器提交异步调用,还可以提交成功/失败的回调函数。

假设你使用jQuery,它将类似于这个:

$.post('submit.php', function(response) {
    //do you want to do anything with response string?
    //do it now
    $.post('mail.php', function(response) {
    });
});

查看文档。