网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站设计 > PHP
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1   IP: 49.87.3.231
Old 2014-12-28, 06:53 PM
Paincourtville Paincourtville is offline
初级会员
 
Join Date: 2011-05-04
Posts: 1
Paincourtville 现在声名狼藉
Default Php生成自定义长度随机字符串的函数分享

这篇文章主要介绍了PHP生成自定义长度随机字符串的函数分享,需要的朋友可以参考下

php随机生成字符串可以自己定义自己所需要的长度,在实际应用开发中,经常遇到。


Code:
//随机生成字符串
function random($length) {
     srand(date("s"));
     $possible_charactors = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     $string = "";
     while(strlen($string)<$length) {
          $string .= substr($possible_charactors,(rand()%(strlen($possible_charactors))),1);
     }
     return($string);
}
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 02:05 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.