我正在构建一些报告,我的代码在本地主机上运行良好,但在服务器上出现错误,我应该如何解决这个问题......
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /localhost/prepare.php:1) in /localhost/prepare.php on line 2
Unable to stream pdf: headers already sent
这是prepare.php
<?php
session_start();
if(isset($_SESSION['usercode']) && isset($_GET['id']))
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/report/formats/'.$_GET['id'].'.php?id='.$_SESSION['usercode']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$st = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$my_html = curl_exec($ch);
if($st==200)
$my_html="Oops! Something went wrong...$st";
curl_close($ch);
require_once("./domppdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($my_html);
$dompdf->render();
$dompdf->stream("report.pdf", array('Attachment'=>'0'));
}
?>