PHP Mail +生成随机字符串

时间:2017-03-09 17:20:02

标签: php string random

我一直在尝试使用randomstring函数发送邮件,但它无法正常工作,它只是不发送电子邮件而且我得到了一个erorr

警告:第11行的/storage/h1/278/426278/public_html/index.php中遇到非数字值

<?php
function generateRandomString() {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < 50; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
mail("censored@gmail.com", ""+generateRandomString(), ""+generateRandomString(), "censored@yahoo.com");
?>

错误是

警告:第11行的/storage/h1/278/426278/public_html/index.php中遇到非数字值

0 个答案:

没有答案