CModel.php 568 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * FecShop file.
  4. *
  5. * @link http://www.fecshop.com/
  6. * @copyright Copyright (c) 2016 FecShop Software LLC
  7. * @license http://www.fecshop.com/license/
  8. */
  9. namespace fec\helpers;
  10. use Yii;
  11. /**
  12. * @author Terry Zhao <2358269014@qq.com>
  13. * @since 1.0
  14. */
  15. class CModel
  16. {
  17. # 1.将models 的错误信息转换成字符串
  18. public static function getErrorStr($errors){
  19. $str = '';
  20. if(is_array($errors)){
  21. foreach($errors as $field=>$error_k){
  22. $str .= $field.':'.implode(",",$error_k)." <br/>";
  23. }
  24. }
  25. return $str;
  26. }
  27. }