我坚持这个特殊问题:
我有一个管理请求流程的php应用程序;发送请求时,还会向多个验证器发送电子邮件。 我想要的是当其中一个验证器未验证请求时,应每30分钟向他发送一次提醒电子邮件。
为此,我创建了与其他类相关的函数,但它不起作用。此函数将作为计划任务执行,但在我尝试将其作为行命令执行之前:' php -f C:\ wamp \ www \ test_2006 \ job.php'
此job.php包含:
我的功能是
public static function autoThread()
{
parent::connection()->open();
foreach( Greeter::getAllRequests() As $request )
{
if( in_array( $stage=$request->stage(),array( "threader","requester","CLOSED" ) ) ) continue;
$currentIdUser = $request->requester()->chef( $stage );
$r = parent::connection()->executeQuery( " SELECT id FROM notification WHERE matriculeUser = '$currentIdUser' AND requestId = {$request->id()} " );
if( $r->rowCount()>2 )
{
( new User( $currentIdUser ) )->judgeRequest( array( $request->id()=>"BYPASS" ) );
}
else
{
parent::connection()->executeQuery( " INSERT INTO notification ( matriculeUser,requestId ) VALUES ( '$currentIdUser',$request->id() )" );
Greeter::validationMail( $request );
}
}
}
我得到的错误是:
Warning: include(php/Classes/FrameworkDb.php): failed to open stream: No such file or directory in C:\wamp\www\test_2006\php\include\head.php on line 3
Call Stack:
0.0000 229496 1. {main}() C:\wamp\www\test_2006\job.php:0
0.0000 236808 2. include('C:\wamp\www\test_2006\php\include\head.php')
C:\wamp\www\test_2006\job.php:3
Warning: include(): Failed opening 'php/Classes/FrameworkDb.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\test_2006\php\include\head.php on li
ne 3
Call Stack:
0.0000 229496 1. {main}() C:\wamp\www\test_2006\job.php:0
0.0000 236808 2. include('C:\wamp\www\test_2006\php\include\head.php')
C:\wamp\www\test_2006\job.php:3
Fatal error: Class 'User' not found in C:\wamp\www\test_2006\php\include\head.php
on line 12
Call Stack:
0.0000 229496 1. {main}() C:\wamp\www\test_2006\job.php:0
0.0000 236808 2. include('C:\wamp\www\test_2006\php\include\head.php')
C:\wamp\www\test_2006\job.php:3
答案 0 :(得分:2)
首先;请在代码块中添加问题本身的任何错误(您可以编辑您的问题)。评论中的错误真的很难读懂......
此外;错误显示no such file or directory
,表示您从不存在的位置包含该文件。请检查路径等。当您使用CLI时,相对路径大多数时间与正常执行(从浏览器)不同。您可以通过定义根路径来解决此问题:
define('ROOT', '/home/users/ssa/');
include ROOT . 'some_dir/my_file.php';
作为ROOT
常量,您将填写文档根目录(您可以在其中找到index.php的目录)。然后,每次包含文件时,都会将常量添加到doc根目录中的相对路径。