我的网站过去工作得很好,但我已经调整了一些小东西,例如添加一个 htaccess 文件来修复 url 等。现在我注意到我的图表没有显示在我的网站上。
这是有问题的页面:
当您通过这样的 URL 直接访问图表时:
你得到这个错误:
JpGraph 错误:HTTP 标头已发送。由第 1 行文件 products.php 的输出引起。说明:在库有机会将其图像 HTTP 标头发送到此浏览器之前,HTTP 标头已被发送回浏览器,指示数据为文本。这使得库无法将图像数据发送回浏览器(因为浏览器会将其解释为文本并显示为垃圾文本)。在调用 Graph::Stroke() 之前,您的脚本中很可能有一些文本。如果此文本被发送回浏览器,浏览器将假定所有数据都是纯文本。查找可能已发送回浏览器的任何文本,甚至是空格和换行符。
For example it is a common mistake to leave a blank line before the opening "<?php".
根据错误,它说这是我的 product.php,如下所示:
<br />
<div class="row">
<div class="span3" style="text-align: center;">
<a class="fancybox" href="<?=$product_data['pLargeImage']?>"><img src="<?=$product_data['pMediumImage']?>" alt="<?=htmlspecialchars($product_data['pTitle'])?>" /></a>
<br />
<span class="small-and-grey">Click image for larger version</span>
</div>
<div class="span6">
<h1 class="product-title"><?=htmlspecialchars($product_data['pTitle'])?></h1><br />
<strong>ASIN</strong> <span class="double-arrow"></span> <?=$asin?>
<?php if (isset($product_data['pManufacturer']) && $product_data['pManufacturer'] != ''): ?>
<br /><strong>Manufacturer</strong> <span class="double-arrow"></span> <?=$product_data['pManufacturer']?>
<?php endif; ?>
<?php if (isset($product_data['pMpn']) && $product_data['pMpn'] != '' && $product_data['pMpn'] != '0'): ?>
<br /><strong>MPN</strong> <span class="double-arrow"></span> <?=$product_data['pMpn']?>
<?php endif; ?>
<br /><strong>Category</strong> <span class="double-arrow"></span> <?=$product_data['pCategory']?>
<?php if (isset($product_data['pEan']) && $product_data['pEan'] != '' && $product_data['pEan'] != '0'): ?>
<br /><strong>EAN</strong> <span class="double-arrow"></span> <?=$product_data['pEan']?>
<?php endif; ?>
</div>
<div class="span3">
<div class="current-prices pull-right">
<?php foreach ($history_data as $id => $row): ?>
<div class="flag-price">
<div class="pull-left">
<a href="<?=htmlspecialchars($row['rAffiliateLink'])?>" rel="nofollow"><img src="<?=base_url() . "img/site/flags/" . $row['rCode']?>.jpg" alt="Amazon <?=$row['rCode']?>"/></a>
</div>
<div class="pull-right">
<a href="<?=htmlspecialchars($row['rAffiliateLink'])?>" rel="nofollow"><?=$row['hRecordedPriceFormatted']?></a>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="small-and-grey pull-right">Click flag to buy direct from Amazon.</div>
</div>
</div>
<br />
<div class="tab-container">
<ul class="nav nav-tabs">
<li class="active">
<span>Overview</span>
</li>
</ul>
<div class="tabbed-data-container">
<div class="row">
<div class="graph-container"><img src="<?=base_url()?>graph/<?=$asin?>/3months" style="width:650px;height:600px;" alt="Item history"/></div>
<div class="span3 pull-right">
<br /><br /><br /><br /><br />
<div class="graph-info">
<span class="title">Please Note:</span><br /><br />
Product prices and availability are accurate as of the date/time indicated and are subject to change.
<br /><br />
The graph will always display the recorded price converted to GBP.
<br /><br />
Converted GBP prices are approximated based on the current exchange rate at the point of being recorded.
</div>
<!--
<div style="margin:20px;margin-left: 0;padding:20px;border:1px solid #ddd;">
<div class="controls">
<label class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked="">
Europe
</label>
<label class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
UK Only
</label>
</div>
<br /><br />
<div class="controls">
<label class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option1" checked="">
6 Months
</label>
<label class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
All time
</label>
</div>
</div>
-->
</div>
</div>
</div>
</div>
<br />
<div class="tab-container">
<ul class="nav nav-tabs">
<li class="active">
<a href="#price_history" data-toggle="tab">Price History</a>
</li>
<!--
<li>
<a href="#price_history" data-toggle="tab">Price History</a>
</li>
-->
</ul>
<div class="tabbed-data-container tab-content">
<div class="tab-pane fade in active" id="price_history">
<table class="table table-striped">
<thead>
<tr>
<th>Region</th>
<th style="text-align:right;">Latest Price</th>
<th style="text-align:right;">Last Change</th>
<th style="text-align:right;">Cheapest Price</th>
</tr>
</thead>
<tbody>
<?php foreach ($history_data as $id => $row): ?>
<tr>
<td><img src="<?=base_url() . "img/site/flags/" . $row['rCode']?>.jpg" alt="Amazon <?=$row['rCode']?>"/> <?=$row['rName']?></td>
<td style="text-align:right;"><?=$row['hRecordedPriceFormatted']?>
<span class="grey">(<?=(isset($row['hConvertedGbpPriceFormatted'])) ? $row['hConvertedGbpPriceFormatted'] : '-';?>)</span>
<br /><span class="small-and-grey"><?=$row['hCreatedFormatted']?></span>
</td>
<td style="text-align:right;">
<?php if ($row['hLastChangeValue'] > 0) echo '<i class="icon-price-up"></i>';?>
<?php if ($row['hLastChangeValue'] < 0) echo '<i class="icon-price-down"></i>';?>
£ <?=($row['hLastChangeValue'] != 0) ? $row['hLastChangeValue'] : '-';?>
<span class="grey">(<?=($row['hLastChangePercent'] != 0) ? $row['hLastChangePercent'] . ' %' : '-';?>)</span>
<br /><span class="small-and-grey"><?=$row['hLastChangeDateFormatted']?></span>
</td>
<td style="text-align:right;"><?=$row['hCheapestPriceFormatted']?>
<span class="grey">(<?=(isset($row['hCheapestConvertedGbpPriceFormatted'])) ? $row['hCheapestConvertedGbpPriceFormatted'] : '-';?>)</span>
<br /><span class="small-and-grey"><?=$row['hCheapestDateFormatted']?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<!--
<pre><?php //print_r($history_data);?></pre>
<div class="tab-pane" id="price_">
</div>
-->
</div>
</div>
<br />
<div class="tab-container">
<ul class="nav nav-tabs">
<li class="active">
<span>Comments</span>
</li>
</ul>
<div class="tabbed-data-container" style="padding-left: 10px; padding-right: 10px;">
<br />
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'hugeriver'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
</div>
有人能告诉我是什么导致它突然停止工作吗?