Php sends an email question ?????? & Lt ;? Php & nbsp; $ pathCommon = dirname (_ FILE __). & quot; \ _ common5 & quot; & nbsp; $ pathCommon = str_replace (& quot; \ cpar1 & quot;, & quot ;, $ pat php sends an email question ??????
$ 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 ('biticontra ');
$ 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 = "guo321@btechnology.com ";
$ Cc = "guo321@btechnology.com ";
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 an error:
Using $ this when not in object context
------ Solution --------------------
A lot of problems.
Function sendMail is a function other than the class. why is there a word like $ this?
The phpMailer () function is also undefined ..
In short, lz can first look at the relevant information of OOP
------ Solution --------------------
Let's make up your other knowledge.
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 = "guo321@btechnology.com"; $Cc = "guo321@btechnology.com"; $test->sendMail("ACTION",'',rtrim($To,","),rtrim($Cc,","),$Text);