有人在 XAMPP 中使用 Google 图表时遇到问题吗?

发布于 2024-09-18 11:42:02 字数 1206 浏览 4 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尛丟丟 2024-09-25 11:42:02

最有可能的是,fopen 包装器未针对 HTTP 请求正确设置。 当 Chartserver-image.php 发出 fopen 请求时。

因此,在浏览器中,直接转到此链接:

 http://localhost/path/to/file/chartserver-image.php

请记住相应地更改路径。您将看到错误以及发生的情况。顺便说一句,它与您发布的代码无关。

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:

 http://localhost/path/to/file/chartserver-image.php

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文