使用DOM PDF创建PDF,pdf创建正常,但post变量不在pdf中。例如,“$ _POST [”docnumber“]”不在PDF中。如果我在它渲染之前回显val,那么一切看起来都很好。
可能只是我很累: - )
以下是一个示例代码:
<?
require("../application.php");
require_once("../dompdf/dompdf_config.inc.php");
$val = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Application</title>
</head>
<body>
<div id="container">
<form action="" method="post">
<table>
<tr>
<td><div id="officeuseonly_left">
<div align="center">OFFICE USE ONLY</div><br /><br />
Document Control #<br />
<input type="text" name="docnumber" id="docnumber" value = "' . $_POST["docnumber"] . '" /><br /><br />
By <input type="text" name="by" id="by" value = ""' . $_POST["by"] .'" /><br />
</div></td>
<tr>
<p><input type="submit" name="submit" value="submit" /></p>
</form>
</div>
</body>
</html>';
if (isset($_POST["submit"])){
$dompdf = new DOMPDF();
$dompdf->load_html($val);
$dompdf->render();
$dompdf->stream("sample.pdf");
}
else
{
echo $val;
}