有人在 XAMPP 中使用 Google 图表时遇到问题吗?
我使用 POST 示例,可以在此处找到。
在 Windows 7 计算机上,它不显示图表,只显示图像的 ALT 文本(我将其添加到示例中)。当我将这两个文件上传到我的网站时,它工作得很好。
有其他人用 XAMPP 尝试过吗?有人会吗?如果它在本地主机上适用,您可以粘贴文本页面的完整代码吗?我将奖励答案。谢谢。
顺便说一句:这是我的测试页。另一个文件 chartserver-image.php
根据 Google 页面
<?php
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">";
echo "<html>";
echo "<head>";
echo "<title>Where's my Google Chart, then?</title>";
echo "<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\">";
echo "<meta HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">";
echo "<meta HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">";
echo "<style type=\"text/css\">";
echo " body { font: 12px Arial; }";
echo "</style>";
echo "</head>";
echo "<body>";
echo "<div>";
echo "<img width='600' height='200' src='chartserver-image.php' alt='alt text'>";
echo "</div>";
echo "</body>";
echo "</html>";
?>
I use the example for POST, found here.
On a windows 7 machine it doesn't show the chart, just the image's ALT text (which I added to the example). When I upload the two files to my website it works just fine.
Has anyone else tried this with XAMPP? Would someone? If it works for you on localhost can you please paste the entire code of your text page & I will award the answer. Thanks.
Btw: here's my test page. The other file chartserver-image.php
is as per Google's page
<?php
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">";
echo "<html>";
echo "<head>";
echo "<title>Where's my Google Chart, then?</title>";
echo "<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\">";
echo "<meta HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">";
echo "<meta HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">";
echo "<style type=\"text/css\">";
echo " body { font: 12px Arial; }";
echo "</style>";
echo "</head>";
echo "<body>";
echo "<div>";
echo "<img width='600' height='200' src='chartserver-image.php' alt='alt text'>";
echo "</div>";
echo "</body>";
echo "</html>";
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最有可能的是,
fopen
包装器未针对 HTTP 请求正确设置。 当 Chartserver-image.php 发出 fopen 请求时。因此,在浏览器中,直接转到此链接:
请记住相应地更改路径。您将看到错误以及发生的情况。顺便说一句,它与您发布的代码无关。
Most probably, the
fopen
wrappers are not set correctly for HTTP requests. As the chartserver-image.php makes the fopen request.So, in your browser, directly go to this link:
Remember to change the path accordingly. You will see the error and what's going on. BTW, it has nothing to do with the code you posted.