by Devin Yang
(This article was automatically translated.)

Published - 1 year ago ( Updated - 1 year ago )

Randomly generate four yards of English

 //產生隨機碼,預設四碼,約七百次會出現碰撞
function get_random_key($length = 4)
{
$permitted_chars = '1234567890abcdefghijklmnopqrstuvwxyxABCDEFGHIJKLMNOPQRSTUVWXYX';
return substr(str_shuffle($permitted_chars), 0, $length);
}

Tags: php

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


phpenv

phpenv database environment

This article describes how to pull out the database service of phpenv to an independent environment. PHPENV can define database services in SERVICE through environment variables. If necessary in the development environment, we can easily restart all services, nginx, fpm and db through commands such as ./start and ./restart. But if it is in online mode, I don't want to restart the website, even the entire DB is restarted. For example, when the php version is updated, the DB does not need to be restarted.

php

How to install PHP 7.1.7 in the old version of CentOS 5.11?

How to install PHP 7.1.7 on the old version of CentOS 5.11? An insfinit error occurred when compiling by myself. This article introduces my method.

docker,php,cli

MacOS's php is not powerful, use docker to execute laravel installer

It's very simple, just add an "alias" alias laravel='docker run --rm -v ${PWD}:/var/www/html -v ~/.dlaravel/cache:/home/dlaravel/.composer /cache -ti deviny/fpm:8.1.10 /home/dlaravel/.composer/vendor/bin/laravel'