String formatting for mailing
Here's the issue.
I make a sring with php like this
$string ="text";
$string .="开发者_C百科text";
$string .="text".$AVarOverHere."more text";
$string .="text";
$string .="text";
echo $AVarOverHere;
This is all working good. But I want to send it as email with Mail.php class that use Pear
So I use
$mail_object->send($recipients, $headers, $string);
Here is the problem.
It's not working when I send the text with the $AvarOverHere that is coming from a function that generate a random string
The function:
function genRandomString() {
$length = 6;
$characters = "0123456789abcdefghijklmnopqrstuvwxyz";
$string ="";
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, (strlen($characters))-1)];
}
return $string;
}
But the funny thing is that if I just do:
$AVarOverHere = 'some string';
It's working!? So what the heck! Anyone know what to do?
Just for kicks, change the "
s to '
s. Sometimes that fixes things...
精彩评论