3

我不断得到:

failed to open Stream: No such file or directory " Path " on line 2

当我尝试从命令行运行这个 php 文件时。

require_once 'modules/Reports/ScheduledReports.php'
VTScheduledReport::runScheduledReports($adb);

我检查了文件是否在那里,并且有一个名为 class VTScheduledReportinScheduledReports.php的类和 function 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();
}

任何人都知道为什么这不会运行?

4

1 回答 1

6

改变

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');
于 2013-08-26T14:09:15.883 回答