php generates random order number and ID. . .

First declare a reference variable in php. Prepare a reference value for subsequent splicing of random numbers. This value can be user ID, product ID, old order ID, etc.
It is best to have fields in your own sql.
$product_id = $_REQUEST['product_id'];
Declare a time variable. Get the value of the current time.
$time=intval(time());
Declare this variable:
$out_trade_no = $time.substr(ip2long($product_id), 3).rand(1000,9999);

This variable is spliced ​​by three variables, namely: time + field in sql + randomly generated one-digit number

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325448686&siteId=291194637