Heim > Backend-Entwicklung > PHP-Tutorial > php使用指定字符列表生成随机字符串的方法,php字符_PHP教程

php使用指定字符列表生成随机字符串的方法,php字符_PHP教程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-07-13 09:56:50
Original
844 Leute haben es durchsucht

php使用指定字符列表生成随机字符串的方法,php字符

本文实例讲述了php使用指定字符列表生成随机字符串的方法。分享给大家供大家参考。具体如下:

<&#63;php
function randomString($len) {
  srand(date("s"));
  $possible="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()";
  $str="";
  while(strlen($str)<$len) {
   $str.=substr($possible,(rand()%(strlen($possible))),1);
  }
  return($str);
}
&#63;>
Nach dem Login kopieren

希望本文所述对大家的php程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/986076.htmlTechArticlephp使用指定字符列表生成随机字符串的方法,php字符 本文实例讲述了php使用指定字符列表生成随机字符串的方法。分享给大家供大家参考。...
Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Aktuelle Ausgaben
PHP-Datenerfassung?
Aus 1970-01-01 08:00:00
0
0
0
PHP-Erweiterung intl
Aus 1970-01-01 08:00:00
0
0
0
Wie man PHP gut lernt
Aus 1970-01-01 08:00:00
0
0
0
Mehrere PHP-Versionen
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage