GlobalHelper.php 887 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /* *****************************************************************
  3. * @Author: wushuiyong
  4. * @Created Time : 一 7/20 15:52:01 2015
  5. *
  6. * @File Name: components/Controller.php
  7. * @Description:
  8. * *****************************************************************/
  9. namespace app\components;
  10. use yii;
  11. class GlobalHelper {
  12. /**
  13. * 获取参数(post/get)的值, 优先级:post > get > default
  14. *
  15. * @param string $name 参数名字
  16. * @param mixed $default 默认值
  17. * @return mixed
  18. */
  19. public static function sendMail($user, $default = null) {
  20. $params = Yii::$app->params;
  21. return Yii::$app->mail->compose()
  22. ->setFrom([$params['support.email'] => $params['support.name']])
  23. ->setTo($user->email)
  24. ->setSubject('Complete registration with ' . Yii::$app->name)
  25. ->send();
  26. }
  27. }