免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 3627 | 回复: 11
打印 上一主题 下一主题

php 饼状图问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-06-12 10:38 |只看该作者 |正序浏览

大家好,我想在一个php网页上加入一些数据统计图,目前使用的是jpgraph图库,我想在已有的php脚本中加入这些图库,应该如何做?

使用require调用么?我用require要报错。

论坛徽章:
154
2022北京冬奥会纪念版徽章
日期:2015-08-07 17:10:5720周年集字徽章-年
日期:2022-10-26 16:44:2015-16赛季CBA联赛之深圳
日期:2022-11-02 14:02:4515-16赛季CBA联赛之八一
日期:2022-11-28 12:07:4820周年集字徽章-20	
日期:2023-07-19 08:49:4515-16赛季CBA联赛之八一
日期:2023-11-04 19:23:5115-16赛季CBA联赛之广夏
日期:2023-12-13 18:09:34
12 [报告]
发表于 2012-06-25 09:10 |只看该作者
gooutya1 发表于 2012-06-19 10:42
问题已解决,用jpgraph生成的图形,先保存到一个文件中,然后主php文件调用图片就行了


这个也不知道能不能直接存到memcache里头

论坛徽章:
0
11 [报告]
发表于 2012-06-19 16:26 |只看该作者
你也可以直接在引用页中使用<img src='pic1.php'>标签进行调用,就像显示验证码图片一样.
这样就不用再去专门去保存图片了.
仅供参考.

论坛徽章:
0
10 [报告]
发表于 2012-06-19 10:42 |只看该作者
问题已解决,用jpgraph生成的图形,先保存到一个文件中,然后主php文件调用图片就行了

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:55:28
9 [报告]
发表于 2012-06-13 09:55 |只看该作者
php文件里有header函数,但是你的文件前面又有html输出,当然会报错,跟require没关系。

解决办法:把php文件里涉及header的部分,放到最前面,生成饼图地址后,在你想要的位置输出。

论坛徽章:
0
8 [报告]
发表于 2012-06-12 13:49 |只看该作者
本帖最后由 gooutya1 于 2012-06-12 13:52 编辑

<!--HTML>
   <HEAD>
      <TITLE>SAN </TITLE>
      <LINK rel="stylesheet" href="./my.css" type="text/css" />
      <LINK rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
   </HEAD>
   <BODY>
-->
<!--DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"-->
<?php
   include('../config.inc.php');
   require("../header.html");
   print("&nbsp;");
   print("<P><H2><u><i>SAN Operatitions Page of $SAN_NAME</i></u></H2></P>");
   include('./pie.php');
?>
.......
下面还有一些form句,和一些表格。我就是想在这个位置插入我的pie图


或者有没有什么群,或者谁愿意给出及时通讯工具,那就最好了,谢谢大家!

论坛徽章:
0
7 [报告]
发表于 2012-06-12 13:44 |只看该作者
JpGraph Error: HTTP headers have already been sent.
Caused by output from file header.html at line 175.
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).
Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.

For example it is a common mistake to leave a blank line before the opening "<?php".

论坛徽章:
0
6 [报告]
发表于 2012-06-12 13:40 |只看该作者
用include也不行呢?你有没有类似的例子

论坛徽章:
0
5 [报告]
发表于 2012-06-12 12:58 |只看该作者
用include试试

论坛徽章:
0
4 [报告]
发表于 2012-06-12 11:53 |只看该作者
不明白你的问题出在哪里?是require引入有问题?

你最好将错误信息都贴出来。
  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP