在使用php oop语法激活电子邮件时,我需要一些帮助

在使用php oop语法激活电子邮件时,我需要一些帮助,php,Php,我的代码几乎可以运行了,但我更愿意使用我的用户类 但是在我的registration.php文件中实现$user=newuser()时,它 不行。到目前为止,我已经得到了以下代码。这只是代码的一部分 <?php require_once 'core/init.php'; // we have autoloader here if(isset($_POST['submit'])) { $random = rand(); $name = $_POST['na

我的代码几乎可以运行了,但我更愿意使用我的用户类 但是在我的registration.php文件中实现$user=newuser()时,它 不行。到目前为止,我已经得到了以下代码。这只是代码的一部分

<?php
 require_once 'core/init.php';  // we have autoloader here


 if(isset($_POST['submit'])) {

      $random = rand();
      $name = $_POST['name'];
      $email = $_POST['email'];
      $to = 'piano0011@hotmail.com';

      $header = 'From: piano0011@hotmail.com';

      $subject = 'Email activation is required';
      $message = <<<EMAIL

      Hello $name How are you? Thank you for registering and please 
      click on the link to activate your account: 
      .http://localhost/pianocourse101/activate.php? 
      email=$_POST['email']

      EMAIL;

      mail($to, $subject, $message, $header);
}

您的代码格式不好。闭合元素不得缩进:

    $message = <<<EMAIL

         Hello $name How are you? Thank you for registering and please 
         click on the link to activate your account: 
         .http://localhost/pianocourse101/activate.php? 
         email=$_POST['email']

EMAIL; // on the first column

$message=如果答案解决了您的问题,请不要忘记关闭您的问题。谢谢看见
    $message = <<<EMAIL

         Hello $name How are you? Thank you for registering and please 
         click on the link to activate your account: 
         .http://localhost/pianocourse101/activate.php? 
         email=$_POST['email']

EMAIL; // on the first column