PHP-如何使 str_shuffle 产生不同的值?
$randomcode="QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm";
$randomcode='NT'.substr(str_shuffle($str),5,8);
echo $randomcode.'<br>';
echo $randomcode.'<br>';
结果:
NT2ZCI1qdX
NT2ZCI1qdX
如何产生不同的值?我想将它插入到我的数据库中。
$randomcode="QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm";
$randomcode=substr(str_shuffle($str),5,8);
$stmt = $pdo->prepare("insert into AGEGroup (AGE,hidecode) values (:age,$randomcode)");
foreach ($_POST['age'] as $age) {
$stmt->execute([':age'=>$age]);
}
非常感谢
富国沪深