galvao/random-string

基于字符类的随机字符串生成器,具有排除特定字符的可能性。

dev-master 2015-12-28 15:00 UTC

This package is auto-updated.

Last update: 2024-08-29 04:26:23 UTC


README

基于字符类的随机字符串生成器,具有排除特定字符的可能性。

已废弃

自PHP7以来,有更好的(且是原生的!)生成随机数据的方法。请查看https://php.ac.cn/manual/en/ref.csprng.php

此存储库将保留为示例材料。

用法

<?php
use RandomString\RandomString;

// Generates a 12 character string with lowercase letters and symbols, excluding the backslash and pipe chracters.
$str = new RandomString(12, array('lowerCase', 'symbols'), array('\\', '|'));
echo $str->result;