开发者

How do I iterate through an array and store it in $message for PHP mail()?

Previously I had issues with arrays and was graciously helped. My problem now is that I have the data in my array, but I need that to be stored into $message so that it will be included when mail() is called. I have chopped up my code and put the relevant piece below.

$to =       '"John Smith" <jsmith@theInter.net>';
$subject =  'Report';
$message =  '===========================================' . '<br>' .
//This is where I would want my array to be located; one element     printed on each line.
'===========================================' . '<br>' . '<br>' .
mail($to, $开发者_开发问答subject, $message);

My array ($fileList) contains one string per element. I want to have one element per line to be included in the above $message variable.

Thank you for any assistance you can give me.


$message = implode( "\n", $fileList );


use implode

implode("<br>", $fileList)


$message = 
    '===========================================<br>' .
    implode("<br>", $fileList) .
    '===========================================<br><br>';


implode is what you search

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜