大家好我不断得到:
failed to open Stream: No such file or directory " Path " on line 2
当我尝试从命令行运行这个php文件时。
require_once 'modules/Reports/ScheduledReports.php'
VTScheduledReport::runScheduledReports($adb);
我已检查文件是否存在,VTScheduledReport
中有一个名为class ScheduledReports.php
的类和函数runScheduledReports
。在那儿。该函数如下所示:
public static function runScheduledReports($adb) {
require_once 'modules/com_vtiger_workflow/VTWorkflowUtils.php';
$util = new VTWorkflowUtils();
$adminUser = $util->adminUser();
global $currentModule, $current_language;
if(empty($currentModule)) $currentModule = 'Reports';
if(empty($current_language)) $current_language = 'en_us';
$scheduledReports = self::getScheduledReports($adb, $adminUser);
foreach($scheduledReports as $scheduledReport) {
$scheduledReport->sendEmail();
$scheduledReport->updateNextTriggerTime();
}
$util->revertUser();
}
任何人都知道为什么这不会运行?
答案 0 :(得分:5)
变化
require_once 'modules/com_vtiger_workflow/VTWorkflowUtils.php';
到
require_once (dirname(__FILE__) . '/modules/com_vtiger_workflow/VTWorkflowUtils.php');
如果您的包含文件路径是相对于脚本的。 dirname(__FILE__)
返回文件的完整路径。
对于ScheduledReports.php
,您可以使用以下
require_once (dirname(__FILE__) . '/modules/Reports/ScheduledReports.php');