我是初学者,我的电子邮件激活功能出现小错误。错误在 for 循环的行中。
<?php
function generateCode(){
$codelength = 20;
// The length of the activation code.
$characters = "abcdefghijklmnopqrstuvwxyz1234567890"; // All accepted characters.
$activatecode = "";
for($i=0;$i<=$codelength;$i++){
$activatecode .= substr(str_shuffle($characters),0,1);
}
return $activatecode;
}
$userActivationCode = generateCode();
?>