我正在使用
我看到的错误信息是:
这是我的代码:
php
、mysql
和 dompdf
开发一个网站,在我的一个表单中有一个按钮,这个按钮需要生成一个 .pdf
文件,并将其通过电子邮件发送。(在我的本地主机上,它可以生成 pdf 文件,但无法发送电子邮件。在我的 Web 服务器上,我无法创建 pdf,但电子邮件已发送...)我看到的错误信息是:
Warning: file_put_contents(C:/Inetpub/vhosts/.../dompdf/lib/fonts/log.htm) [function.file-put-contents]: failed to open stream: Permission denied in C:\Inetpub\vhosts\...\dompdf\include\dompdf.cls.php on line 864
//the mistake in in the `dompdf` class
Warning: file_put_contents(pdf/pdfgenerados/cotizacion.pdf) [function.file-put-contents]: failed to open stream: Permission denied in C:\Inetpub\vhosts\...\list.php on line 116
这是我的代码:
$codigoHTML=utf8_decode($codigoHTML);
$dompdf=new DOMPDF();
$dompdf->load_html($codigoHTML);
ini_set("memory_limit","128M");
$dompdf->render();
$pdf = $dompdf->output();
file_put_contents("pdf/pdfgenerados/cotizacionnueva.pdf", $pdf);
echo "Cotización generada";
//<<-------------- Send by email------------>>>
$fileat = "pdf/pdfgenerados/cotizacionnueva.pdf";
$fileat_type="pdf";
$fileatname= "Cotización.pdf";
$emailfrom="my-email@hotmail.es";
$emailsubject="Cotización";
$emailmessage="------------ Here you have the pdf file... have a nice day";
$emailto="other_e-mail@gmail.com";//
$headers = "From: $emailfrom";
$file = fopen($fileat,'rb');
$data = fread($file,filesize($fileat));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$data = chunk_split(base64_encode($data));
$data . "nn --{$mime_boundary}--n";
$ok = @mail($emailto, $emailsubject, $emailmessage, $headers);
if($ok) {
echo " <br/><font face=verdana size=2>The file was successfully sent!</font>";
} else {
die("Sorry but the email could not be sent. Please go back and try again!");
}
我收到了邮件,但是没有收到PDF文件。
我该怎么办?