我想邮寄一个网页的内容,如下所示:
<html>
<body>
<?php
function sendPageContentToEmail($destEmail)
{
ob_start();
$buffer = ob_get_contents();
ob_end_clean();
$subject = 'Subject name';
mail($destEmail, $subject, $buffer);
}
?>
<div style="width:400px; margin:0 auto;">
<p>
Name: <?php print($customerData['customer_name']); ?>
</p>
<p>
....
</p>
</div>
</body>
</html>
<?php
sendPageContentToEmail($customerData['customer_email']);
//erase all temp data
session_destroy();
?>
无论在哪里调用 sendPageContentToEmail(),$buffer 始终为空 (ob_get_content())。应该在哪里调用这个函数(假设它是正确的方法)?