A product was developed yesterday and requires that a registration code serial number be generated by the general background of the website, which is then generated in the format of 573-225-374-118 and is unique in the database, next I will record all the information I found and I wrote myself. The principle is to generate mt... A product was developed yesterday and requires that a registration code/serial number be generated by the general background of the website, and then generated in the format of 573-225-374-118, which is unique in the database, next I will record all the information I found and I wrote myself.
The principle is to generate mt_rand random seed and then use the relevant functions for read operations.
Example 1 code:
'; Return $ serialNumber;} echo snMaker (); /*** replace a part of a string with a specific character * @ param str or int $ string to be processed by str * @ param str or int $ * @ param int $ start keep the first few characters * @ param int $ end keep the last few characters */function hideString ($ str = 'hello ', $ to = '*', $ start = 1, $ end = 0) {$ lenth = strlen ($ str)-$ start-$ end; $ lenth = ($ lenth <0 )? 0: $ lenth; $ to = str_repeat ($ to, $ lenth); $ str = substr_replace ($ str, $ to, $ start, $ lenth); return $ str ;} echo hideString ();?>
Example 2: generate the registration code/serial number. the reference content is as follows:
The execution of the program will generate the cd_key.txt file, which contains a verification code similar to the following, which is referenced below:
573-225-374-118,691-553-280-280,969-594-607-211,251-575-776-563,280--289-739-533...
In this way, we fully achieve our goal. you can also save the above random strings to the database for convenient calling and flexible setting of the above variables, you can generate 16-bit and 20-bit verification codes. if you are interested, you can also write verification codes similar to XDF8F-ADE89-D0J5C-4RTFG.
Link to this article:
Add to favorites ^ please keep the tutorial address.