Skip to content

Commit

Permalink
Merge pull request #15 from kunx-edu/master
Browse files Browse the repository at this point in the history
解决在32位PHP环境下随机数生成器报边界超出整数范围错误的问题.
  • Loading branch information
BigKuCha authored Aug 31, 2016
2 parents 05ec50c + 032a9b8 commit 73afbb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private function getFullName()
$format = str_replace("{filename}", $oriName, $format);

//替换随机字符串
$randNum = rand(1, 10000000000) . rand(1, 10000000000);
$randNum = mt_rand(1, 1000000000) . mt_rand(1, 1000000000);
if (preg_match("/\{rand\:([\d]*)\}/i", $format, $matches)) {
$format = preg_replace("/\{rand\:[\d]*\}/i", substr($randNum, 0, $matches[1]), $format);
}
Expand Down

0 comments on commit 73afbb3

Please sign in to comment.