CRON JOB无法下载文件并将附件添加到文件

时间:2018-10-22 11:12:34

标签: php cron cron-task

我想创建一个CRON作业,该作业会生成一个.xls报告并将其邮寄给客户端。 我为此创建了单独的文件。

1.automailerCron.php(用于下载后发送邮件) 2.autodownloaderCron.php(用于下载文件)

注意:通过手动定位URL,两个文件在本地服务器上都可以正常运行,通过手动定位URL,autodownloaderCron.php在Web服务器上也可以正常运行

<?php  
        //code of autodownloaderCron.php
        session_start();

        $_SESSION['userName'] = "dmin";
        $_SESSION['userEmail'] = "we@welco.com";
        $_SESSION['userLevel'] = 1;
        $_SESSION['userLastLogin'] = "2018-10-20 12:02:03";
        $_SESSION['shop'] = 2;
        $_SESSION['userId'] = 10;
        $_SESSION['sessionId'] = session_id();

        $autoDate = date("Y-m-d",strtotime("2018-09-04"));

        header("LOCATION:dayWise.php? Download=Generate&autoDate=$autoDate&filePath=SET&randName=$randName");
    ?>

    <?php
         //code of automailerCron.php
         session_start();
         include_once("../config/data.config.php");
         require("../phplib/PHPMailer/PHPMailerAutoload.php");
         require("../phplib/class.mailer.php");
         $sendAutoMail = new sendMail;
         $randName = "daily_booking_report";
         $content = "Dear Support Team,<br><br> Kindly find the attachment of Booking Report<br><br> Regards, <br> RoomStatusHUB";

        $sendAutoMail->autoMail('automailer@rhub.com',"suort@rhub.com","Daily Booking Report",$content,"",$randName,$randName);
?>

0 个答案:

没有答案