我不确定为什么我的数组中的第一个值会添加<p>
标签,而其余的在标签内效果很好li
。
//user posted variable
$checks = $_POST['personalization_result'];
//handling the form data and outputting it into a list
if(!empty($checks)){
$checkValues = array_values($checks);
$checkString = implode('<li style="list-style: none;">'.get_post_meta($post->ID, '_moon_question', true).'', $checkValues);
}
// I need this filter so it can parse the html in the email
add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));
//E-mailing my form data here
$sent = wp_mail($to, $subject, $checkString, $headers);
这可行,电子邮件已发送,但由于某种原因,它看起来像这样。
<p>1</p> //this is the first value it should look like below
<li style="list-style: none;">Suits1</li>
<li style="list-style: none;">Suits1</li>
<li style="list-style: none;">Suits1</li>
<li style="list-style: none;">Suits0</li>
<li style="list-style: none;">Suits0</li>
我希望我能找出问题所在,但坦率地说,我不确定问题出在哪里?我觉得它的内部implode
可能没有正确编写 HTML?