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.
20 lines
429 B
20 lines
429 B
<?php
|
|
|
|
namespace App\Service\v3\Implementations;
|
|
|
|
use App\Service\v3\Interfaces\HelperServiceInterface;
|
|
|
|
class HelperService implements HelperServiceInterface
|
|
{
|
|
|
|
public function makeNumCode($length)
|
|
{
|
|
// 获取验证码
|
|
$codeArr = array_map(function ($item) {
|
|
return mt_rand(0,9);
|
|
}, array_pad([], $length, 0));
|
|
|
|
// 返回验证码
|
|
return implode('', $codeArr);
|
|
}
|
|
}
|