Require()
) and call class.
Note. this file is use the namespace.
When calling a class, prefix the class name with n138
.<?php
Require_once('GetRandStr.php');
$genRandomStr = new n138\genRandomStr();
$genRandomStr->setLength(24); // change the length. default is 8 len.
$genRandomStr->setCharType(12); // change the character. default is 15(all) char.
echo $genRandomStr->getResult();
| Type | Mask | Value | | —- | —- | —– | | all | 1111 | 15 | | num | 1000 | 8 | | sym | 0100 | 4 | | low | 0010 | 2 | | up | 0001 | 1 |
$ php sample.php ; echo '';
0<#,^(5[@\:)&#>!{*5~<$5)
$
$ php -v
PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
$ httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Apr 2 2020 13:13:23
$ uname -r
3.10.0-1127.19.1.el7.x86_64
$ cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
The character type that is output can be changed by putting the character specified in the chr
argument.
i.e. http://yourserver/GetRandStr?chr=11
Please look the #genrandomstr-setchartype
You can change the number of characters by putting a number in the len
argument.
i.e. http://yourserver/GetRandStr?len=12
Options
chr
andlen
can be used in combination
| argument | value | |:—- |:———– | | chr | 15 | | len | 8 |