網上好多答案都過時了,這裡重新記一下
一、使用composer安裝phpmailer
* * notes:傳送郵件
* @param string $tomail 接收郵件者郵箱
* @param string $name 接收郵件者名稱
* @param string $subject 郵件主題
* @param string $body 郵件內容
* @param string $attachment 附件列表
* @return boolean
* @throws phpmailerexception */
function send_mail($tomail, $name, $subject = '', $body = '', $attachment = null
) }
return
$mail->send() ? true : $mail->errorinfo;
}三,在控制器中呼叫
public四、測試function
send_email()
tp5快取使用
引入 usethink cache 使用 options 快取型別為file type file 快取有效期為永久有效 expire 0,快取字首 prefix think 指定快取目錄 path runtime cache cache connect options if cache has th...
Thinkphp使用PHPMailer傳送郵件
一 郵箱前期準備 註冊完之後,就要去開啟 pop3 smtp imap服務。在開啟服務時,需要客戶端授權密碼 記住這個授權密碼!服務開啟後,如果設定 姓名 在寫郵件傳送時會提示設定 姓名 後才能傳送郵件,當然也可以提前設定好 二 部分 修改配置檔案 向conf.php配置檔案中新增以下內容 進行郵箱...
TP5使用模型查詢資料
前提 引入model 1.get 方法,引數為 主鍵值 res user get 1 toarray 方法是將 get的值,轉為陣列 res res toarray get 方法還支援閉包 res user get function query res res toarray dump res 2....