php电子邮件中的html

php电子邮件中的html,php,html,email,Php,Html,Email,有人能解释一下为什么会这样吗$结束 与的工作方式不同$敬礼 在下面的代码中?我错过了什么 $salutation = 'Greetings, ' . $cname; $ending = 'Thank you for using HammerPins, ' . $cname; $subject = 'Hammerpins.net Alert: Newly Added Bowling Tourn

有人能解释一下为什么会这样吗$结束

与的工作方式不同$敬礼

在下面的代码中?我错过了什么

                    $salutation = 'Greetings, ' . $cname;
                $ending = 'Thank you for using HammerPins, ' . $cname;

                $subject = 'Hammerpins.net Alert: Newly Added Bowling Tournaments';
                $message = '
                <html>
                <body>
                    <p>' . $salutation . '!</p>
                    <p>New tournaments were added to the HammerPins database this week in the following counties:</p>';
                    foreach ($user_array as $single_user_item) {
                        $message .= "$single_user_item[link]";
                    }'
                    <p>' . $ending . '!</p>
                </body>
                </html>
                ';
$saltation='问候语'$cname;
$ending='谢谢您使用锤子钉'$cname;
$subject='Hammerpins.net警报:新增加的保龄球比赛';
$message='1
"$敬礼

本周,在以下几个县的HammerPins数据库中增加了新的锦标赛:

'; foreach($user\u数组作为$single\u user\u项){ $message.=“$single_user_项目[链接]”; }' "$结束

';

感谢您的帮助。

因为您在foreach循环之前就结束了原始语句。请尝试以下方法:

                $salutation = 'Greetings, ' . $cname;
            $ending = 'Thank you for using HammerPins, ' . $cname;

            $subject = 'Hammerpins.net Alert: Newly Added Bowling Tournaments';
            $message = '
            <html>
            <body>
                <p>' . $salutation . '!</p>
                <p>New tournaments were added to the HammerPins database this week in the following counties:</p>';
                foreach ($user_array as $single_user_item) {
                    $message .= "$single_user_item[link]";
                }
                $message .= '<p>' . $ending . '!</p>
            </body>
            </html>
            ';
$saltation='问候语'$cname;
$ending='谢谢您使用锤子钉'$cname;
$subject='Hammerpins.net警报:新增加的保龄球比赛';
$message='1
"$敬礼

本周,在以下几个县的HammerPins数据库中增加了新的锦标赛:

'; foreach($user\u数组作为$single\u user\u项){ $message.=“$single_user_项目[链接]”; } $message.=''$结束

';
因为您在foreach循环之前结束了原始语句。请尝试以下方法:

                $salutation = 'Greetings, ' . $cname;
            $ending = 'Thank you for using HammerPins, ' . $cname;

            $subject = 'Hammerpins.net Alert: Newly Added Bowling Tournaments';
            $message = '
            <html>
            <body>
                <p>' . $salutation . '!</p>
                <p>New tournaments were added to the HammerPins database this week in the following counties:</p>';
                foreach ($user_array as $single_user_item) {
                    $message .= "$single_user_item[link]";
                }
                $message .= '<p>' . $ending . '!</p>
            </body>
            </html>
            ';
$saltation='问候语'$cname;
$ending='谢谢您使用锤子钉'$cname;
$subject='Hammerpins.net警报:新增加的保龄球比赛';
$message='1
"$敬礼

本周,在以下几个县的HammerPins数据库中增加了新的锦标赛:

'; foreach($user\u数组作为$single\u user\u项){ $message.=“$single_user_项目[链接]”; } $message.=''$结束

';
您丢失了$message.=在foreach的}关闭之后

您丢失了$message.=在foreach的}关闭之后

我不相信!我真的以为我已经试过了,但我猜不是。非常感谢您的帮助!我不相信!我真的以为我已经试过了,但我猜不是。非常感谢您的帮助!