【发布时间】:2012-02-11 23:29:09
【问题描述】:
我正在运行一个使用 file_get_contents 的 php 脚本,以便通过邮件发送一个列表,其中包含该远程文件中的内容。 如果我手动运行脚本,一切正常,但是当我离开它并等待 cron 运行时,它不会获得远程内容.....这可能吗? 我在这里复制一些我认为问题所在的代码:
$flyer = file_get_contents('flyer.html');
$desti = $firstname." ".$lastname;
$mail = new phpmailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "orion.xxxx.com"; // line to be changed
$mail->Port = 465; // line to be changed
$mail->Username = 'bob@xxxx.com'; // line to be changed
$mail->Password = 'xxxx90'; // line to be changed
$mail->FromName = 'Bob'; // line to be changed
$mail->From = 'bob@xxxx.com';// line to be changed
$mail->AddAddress($email, $desti);
$mail->Subject = 'The Gift Store'; // to be changed
if ($cover_form == '1'){ $mail->MsgHTML($long10);} else
if ($cover_form == '2'){ $mail->MsgHTML($customer);} else
if ($cover_form == '3'){ $mail->MsgHTML($freedoers);} else
if ($cover_form == '4'){ $mail->MsgHTML($freelongform);} else
if ($cover_form == '5'){ $mail->MsgHTML($freestoreshort);} else
if ($cover_form == '6'){ $mail->MsgHTML($getasiteshort);} else
if ($cover_form == '7'){ $mail->MsgHTML($flyer);}
else {}
【问题讨论】:
-
flyer.html位于何处?如果是本地的,你应该为 cron 使用绝对路径。
标签: php cron file-get-contents