斗士狗
2010-12-04 22:56Php 随机字符串生成器
I'm trying to create a randomized string in PHP, and I get absolutely no output with this:
<?php
function RandomString()
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randstring = '';
for ($i = 0; $i < 10; $i++) {
$randstring = $characters[rand(0, strlen($characters))];
}
return $randstring;
}
RandomString();
echo $randstring;
What am I doing wrong?
转载于:https://stackoverflow.com/questions/4356289/php-random-string-generator
- 点赞
- 回答
- 收藏
- 复制链接分享
30条回答
为你推荐
- PHP随机字符串生成器基于GET值[关闭]
- html
- php
- 3个回答
- 这个随机字符串生成器有什么问题?
- random
- string
- arrays
- php
- generator
- 1个回答
- 随机字符串生成器使字符串长度错误(PHP)
- php
- 5个回答
- 将随机字符串路由到CodeIgniter中的特定控制器?
- codeigniter
- routes
- url-rewriting
- php
- 1个回答
- Php 随机字符串生成器
- random
- string
- php
- 0个回答
换一换