小编Far*_*Far的帖子

我是Prolog的新手。尝试运行此代码,但给出-错误:未定义的过程:示教2(DWIM无法更正目标)

这些是我写的事实

instructor(ahmed,mohammed, cs101,01).
instructor(sara,salah,cs101,02).
instructor(maryam,faisal,cs101,03).
instructor(ali,hassan,cs311,01).

enrolled(201110202,huda,issa,cs101,01).
enrolled(20110303,mona,amer,cs101,01).
enrolled(20115566,amal,omar,cs101,01).
enrolled(20118899,ahmed,hassan,cs101,01).
Run Code Online (Sandbox Code Playgroud)

规则

teaches(D,S):-
   instructor(D,_,C,Z),
   enrolled(S,_,_,C,Z).

classmate(s1,s2,C):-
  enrolled(s1,_,_,C,Z),
   enrolled(s2,_,_,C,Z).
Run Code Online (Sandbox Code Playgroud)

但是,当我运行一个查询,该查询用id教std时20110303,就会出现此错误。我已经检查了所有类型的错误。从语法和逻辑上讲这是正确的,但仍然表示未定义的过程

?- debug.
   true.

[debug]  ?-  teaches(D,20110303).
ERROR: Undefined procedure: teaches/2 (DWIM could not correct goal)
Run Code Online (Sandbox Code Playgroud)

procedure prolog undefined

4
推荐指数
1
解决办法
9418
查看次数

无法声明类 PHPMailer\PHPMailer\Exception,因为该名称已被使用

错误: Cannot declare class PHPMailer\PHPMailer\Exception, because the name is already in use.

下面是正在使用的代码

 require '/home3/afaflawm/vendor/phpmailer/phpmailer/src/Exception.php';
require '/home3/afaflawm/vendor/phpmailer/phpmailer/src/PHPMailer.php';
require '/home3/afaflawm/vendor/phpmailer/phpmailer/src/SMTP.php';
// Load Composer's autoloader
 require 'vendor/autoload.php';
   use PHPMailer\PHPMailer\PHPMailer;
 use PHPMailer\PHPMailer\SMTP;
 use PHPMailer\PHPMailer\Exception;
   function SendSMTPemail(){
  try {
 $mail = new PHPMailer(true);
  $mail->SMTPDebug = SMTP::DEBUG_SERVER;  
    $mail->Host='ssl';
       $mail->isSMTP();                                            
    $mail->SMTPAuth   = true;                                   
     $mail->Username='xy@xy.com'; 
    $mail->Password='xxxxxxx'; 
       $mail->setFrom('xy@xy.com');
       $mail->AddAddress('yz@yz.com');                             // SMTP password
    $mail->SMTPSecure = 'ssl';
    $mail->Port       = 465;                                    // TCP port to connect to
    $mail->addReplyTo('ab@ab.com', 'Information');
        $mail->isHTML(true);  
   $mail->Subject = "Appointment Details";
    $mail->Body    = "Dear, <br> Please be informed …
Run Code Online (Sandbox Code Playgroud)

php phpmailer

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

php ×1

phpmailer ×1

procedure ×1

prolog ×1

undefined ×1