php Send mail problem??????
$pathCommon = DirName (__file__). " \_common5 ";
$pathCommon =str_replace ("\cpar1", "", $pathCommon);
Include ($pathCommon. ' \root.php ');
Class test{
var $dbCon;
var $root;
var $pathCommon;
var $js;
var $func;
var $funcUsage;
var $css;
var $mail;
function Test ($pathCommon = "") {
$this->pathcommon = $pathCommon;
$this->root = new root ($this->pathcommon);
$this->root->db ();
$this->dbcon = new DB (' Bitintra ');
$this->dbcon->errorshow = true;
$this->js = $this->root->javascript ();
$this->func = $this->root->functional ();
$this->funcusage = $this->func->usage ();
$this->css = $this->root->css ();
$this->view = $this->root->view ();
$this->page = $this->view->page ();
$this->box = $this->view->box ();
$this->grp = $this->view->group ();
$this->mail = $this->root->mail ();
}
}
$To = "[email protected]";
$Cc = "[email protected]";
SendMail ("ACTION", "', RTrim ($To,", "), RTrim ($Cc,", "), $Text);
function SendMail ($sendTo, $stepIndex = "", $to = "", $CC = "", $Text = "") {
$this->mail->phpmailer ();
$msg = '
Dear All
';
$msg. = $Text;
$subject = "Test";
$this->mail->sendmail ($subject, $msg, "test", $to, $CC, "", "", "AA");
}
? >[code=php][/code]
------Solution--------------------
You should encounter such a similar error:
Using $this when not in object context
------Solution--------------------
A whole bunch of questions.
function SendMail are functions outside the class, why are there $this words like this?
The Phpmailer () function is also undefined:
In short, LZ can first look at the relevant information of OOP
------Solution--------------------
Other aspects of the knowledge of their own bad to fill it.
PHP Object-Oriented programming
PHP Code
$pathCommon = DirName (__file__). " \_common5 "; $pathCommon =str_replace ("\cpar1", "", $pathCommon); Include ($pathCommon. ' \root.php '); class test{var $dbCon; var $root; var $pathCommon; var $js; var $func; var $funcUsage; var $css; var $mail; function Test ($pathCommon = "") {$this->pathcommon = $pathCommon; $this->root = new root ($this->pathcommon); $this->root->db (); $this->dbcon = new DB (' Bitintra '); $this->dbcon->errorshow = true; $this->js = $this->root->javascript (); $this->func = $this->root->functional (); $this->funcusage = $this->func->usage (); $this->css = $this->root->css (); $this->view = $this->root->view (); $this->page = $this->view->page (); $this->box = $this->view->box (); $this->grp = $this->view->group (); $this->mail = $this->root->mail (); } function SendMail ($sendTo, $stepIndex = "", $to = "", $cc =" ", $Text =" ") {$this->mail->phpmailer (); $msg = 'Dear All
'; $msg. = $Text; $subject = "Test"; $this->mail->sendmail ($subject, $msg, "test", $to, $CC, "", "", "AA");}} $test = new test (); $To = "[email protected]"; $Cc = "[email protected]"; $test->sendmail ("ACTION", "', RTrim ($To,", "), RTrim ($Cc,", "), $Text);
-