我会以PDF格式动态显示记录,但会显示静态数据(HTML),而php变量将显示为空白屏幕或1. ex。 $ head变量。
<?php
require_once("includes/config.php");
$Admin = new admins;
$performance = $Admin->select($Admin->performance,'',"id=".$_GET['id']);
$head = $performance[0]['research_head'];
$url = 'http://freehtmltopdf.com';
$data = array('convert' => '','html' => '<html><head><title>Invesys Capital</title>
</head>
<body>
*****<div>'.print_r($head).'</div>*****
</body>
</html>
','baseurl' => 'http://technobratz.in/invesyscapital/');
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
// set the pdf data as download content:
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="webpage.pdf"');
var_dump($result);
?>