做了一些实验用
exec和
shell_exec我已经揭露了完美工作的解决方案!我选择使用,
shell_exec这样我就可以记录发生(或不发生)的每个通知过程。(
shell_exec以字符串形式返回,这比使用
exec,将输出分配给变量然后打开要写入的文件要容易得多。)
我正在使用以下行来调用电子邮件脚本:
shell_exec("/path/to/php /path/to/send_notifications.php '".$post_id."' 'alert' >> /path/to/alert_log/paging.log &");重要的是要注意
&命令的末尾(@netprer指出)。该UNIX命令在后台运行一个进程。
脚本路径后用单引号引起来的多余变量被设置为
$_SERVER['argv']可以在脚本中调用的变量。
然后,电子邮件脚本使用将输出到我的日志文件
>>,并将输出如下内容:
[2011-01-07 11:01:26] alert Notifications Sent for http://alerts.illinoisstate.edu/2049 (script: 38.71 seconds)[2011-01-07 11:01:34] CRITICAL ERROR: alert Notifications NOT sent for http://alerts.illinoisstate.edu/2049 (script: 23.12 seconds)



