Jon*_*tan 6 php model-view-controller controller model php-5.3
每当我从模型或控制器发送邮件时,我都会遇到问题.事情是在我使用的控制器中
这是关于PHP的.
在控制器中:
if (Post::get()){
$this->model->registerUser( ... );
$this->model->mailSendUserActivation();
// assign something to view.
}
Run Code Online (Sandbox Code Playgroud)
在模型中:
public function mailSendUserActivation(){
$mail = new \com\Mail();
// assign stuff to mail from API classes and other functions in model.
$mail->send();
}
Run Code Online (Sandbox Code Playgroud)
它是否正确 ?或者邮件真的应该从控制器发送?