You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
429 B

  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Service\v3\Interfaces\HelperServiceInterface;
  4. class HelperService implements HelperServiceInterface
  5. {
  6. public function makeNumCode($length)
  7. {
  8. // 获取验证码
  9. $codeArr = array_map(function ($item) {
  10. return mt_rand(0,9);
  11. }, array_pad([], $length, 0));
  12. // 返回验证码
  13. return implode('', $codeArr);
  14. }
  15. }