Anyone having problems with Google charts in XAMPP?

≯℡__Kan透↙ 提交于 2019-12-11 17:17:43

问题


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>";
?>

回答1:


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.



来源:https://stackoverflow.com/questions/3682622/anyone-having-problems-with-google-charts-in-xampp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!