Laravellaravel 使用PHPmailer扩展composer require phpmailer/phpmailer use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; public function test(){ // echo "ceshi"; $mail = new PHPMailer(true); //作者王明昌发布时间2019-01-12复制composer require phpmailer/phpmailer use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; public function test(){ // echo "ceshi"; $mail = new PHPMailer(true); // Passing `true` enables exceptions try { //Server settings $mail->SMTPDebug = 2; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.qq.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******@qq.com'; // SMTP username $mail->Password = '*********'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to //Recipients收件人 $mail->setFrom('*******@qq.com', 'Mailer');//发件人 $mail->addAddress('***@qq.com', 'Joe User'); // Add a recipient收件人 // $mail->addAddress('[email protected]'); // Name is optional可选 // $mail->addReplyTo('[email protected]', 'Information'); // $mail->addCC('[email protected]'); // $mail->addBCC('[email protected]'); //Attachments // $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; } }
2019-01-10laravel多条件排序$goods = Goods::orderBy('created_at','desc')->orderBy('id','desc')->paginate(6);
2018-03-11laravel开发博客遇到的问题(一)1.引入css,js,img等最好使用asset 使用此方式,获取的是带域名的绝对路径 2.测试数据库是否连接正常数据库 use DB; $pdo = DB::connection()->getPdo
2019-01-12laravel 使用生成二维码扩展composer require simplesoftwareio/simple-qrcode 1.5.1 // 在config/app.php 注册服务提供者: SimpleSoftwareIO\Q
2019-02-09laravel新建应用报错:The Process class relies on proc_open, which is not#laravel new blog Crafting application... [Symfony\Component\Process\Exception\RuntimeException] The
2020-01-01laravel 使用 Editor.md关于图片上传csrf的处理 大家都知道laravel默认提交表单时是启用csrf验证的 那么关于Editor.md关于图片上传csrf的处理有两个 1. 关闭csrf验证  加入csrf验证 上传方法:  视图: 加入t
2019-01-12laravel migration 中integer方法无法指定长度查看源代码后发现integer方法的第二个参数并不是指定长度,而是是否设置auto increment, 所以integer方法无法指定子段长度,默认为11。