我正在尝试从 a 中获取一些 htmltextarea
并将其转换为 pdf。我从https://github.com/dompdf/dompdf下载了DOMPDF并编写了下面的代码。当我单击提交时,我收到此错误:“内部服务器错误”。(我的虚拟主机没有告诉我它是哪一行)(这个文件的名称是 test2.php)
<?php
if (isset($_POST['submit'])) {
$content = $_POST['content'];
if (empty($content)){
$error = 'write something';
}
else {
include_once( 'dompdf/dompdf_config.inc.php' );
$dompdf = new DOMPDF();
$dompdf->load_html($content);
$dompdf->render();
$dompdf->stream('example.pdf');
}
}
?>
<!DOCTYPE html>
<head>
</head>
<body>
<?php
if(isset($error)){
echo $error;
}
?>
<form method="post" action="test2.php">
<textarea name="content" id="content">hello world</textarea><br>
<input type="submit" name="submit" value='submit'>
</form>
</body>
</html>