1、目的:利用php的do .. while 生成一个不重复的字符串或者数组,比如(订单号、会员号)

2、不废话,代码来:

$repeat_order = array();
do{
$ordersn = date('md') . random(8, 1);
$repeat_order = pdo_fetch("SELECT * FROM ".tablename($tablename)." WHERE weid = '{$_W['uniacid']}' AND ordersn = :ordersn", array(':ordersn' => $ordersn));
}while(!empty($repeat_order));
04-15 18:01