by Devin Yang
(This article was automatically translated.)

Published - 2 years ago ( Updated - 2 years 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


openspeedtest,docker,phpenv

Run OpenSpeedTest with phpenv

Although we may use websites such as speedtest to test the speed of uploading and uploading, what if we want to test the speed of our own Server? For example, if the user is in another country, the speed of connecting to our host is slow, then the self-hosted test tool is very convenient. The latest version of phpenv has added openspeedtest.yml to the yml file of services.

docker,phpenv

Unable to ping host.docker.internal on Linux

You can check with docker version, confirm that the version is Docker v20.10+, you can add extra_hosts as follows:

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'