php excel文件生成无法使用cron作业

时间:2021-11-06 01:09:07

I create a file to write an excel using phpexcel classa dne sending that via email whileiam running tht file directly its working fine. But if i set it as a cron job its not working. I checked all the file path used in that file cant find any issue. Checked line by line execution at that time found that if i add this two lines that mail not sending

我创建了一个文件来编写一个excel使用phpexcel classa dne发送,通过电子邮件whileiam直接运行该文件其工作正常。但是,如果我把它设置为一个cron工作,它就不起作用了。我检查了该文件中使用的所有文件路径无法找到任何问题。当时逐行执行检查发现,如果我添加这两行邮件不发送

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('comments_excels/comments_'.$date.'.xls');

1 个解决方案

#1


Try to use something like

尝试使用类似的东西

$filename = getcwd().'/yourfile.txt';

This worked for me.

这对我有用。

#1


Try to use something like

尝试使用类似的东西

$filename = getcwd().'/yourfile.txt';

This worked for me.

这对我有用。