1

pCharts 文档说您应该能够使用此代码将图像呈现给浏览器。

mypic.php

$myPicture->stroke;

我的页面.html

<IMG SRC=‘mypic.php‘&gt;

img标签应该调用 php 脚本。在 PHP 脚本中,stroke 函数将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;
?>

索引.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。

4

3 回答 3

1

尝试删除

<?php
     include ('netsales.php');
?>

从 index.php,并添加

header('Content-Type: image/png');

在中风电话之前。

于 2011-05-27T13:21:23.470 回答
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"); 

?>
///////////////////////////////////
于 2013-08-30T15:47:22.843 回答
0

我刚刚让它为我工作我在 HTML 文件中有注释包含函数:

<?php //include ('my.php'); ?>
于 2013-09-12T09:26:34.637 回答