pCharts文档说您应该能够使用此代码将图像渲染到浏览器。
mypic.php
$myPicture->stroke;
的mypage.html
<IMG SRC=‘mypic.php‘>
img
标签应该调用php脚本。在PHP脚本中,笔触函数设置content-type: image/png
。
所以这就是我所拥有的:
netsales.php
<?php
include('../class/pData.class.php');
include('../class/pDraw.class.php');
include('../class/pImage.class.php');
/* query sales and create new image */
$myPicture->stroke;
?>
的index.php
<?php
include ('netsales.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div>
<img src="netsales.php" />
</div>
</body>
</html>
我没有收到任何错误,只有红色X表示丢失的图像。
答案 0 :(得分:1)
尝试删除
<?php
include ('netsales.php');
?>
从index.php开始,添加
header('Content-Type: image/png');
在中风之前。
答案 1 :(得分:0)
我尝试这样的事情并且有效:
//html file//////////////////////
<?php include ('my.php'); ?>
<html>
<head></head>
<body>
<div> <img src="my.php" /> </div>
</body>
</html>
///////////////////////////////////
//my.php file/////////////////////////
<?php
/* pChart library inclusions */
include("pChart/class/pData.class.php");
include("pChart/class/pDraw.class.php");
include("pChart/class/pImage.class.php");
//...
$myPicture->autoOutput("picture.png");
?>
///////////////////////////////////
答案 2 :(得分:0)
我让它为我工作我在HTML文件中有注释包含功能:
<?php //include ('my.php'); ?>