pChart 不会呈现到 Web 浏览器,仅显示缺失的图像

发布于 2024-10-19 03:42:27 字数 1082 浏览 5 评论 0原文

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。

pCharts documentation says that you should be able to render the image to the browser using this code.

mypic.php

$myPicture->stroke;

mypage.html

<IMG SRC=‘mypic.php‘>

The img tag is supposed to invoke the php script. Within the PHP script, the stroke function sets the content-type: image/png.

So here is what I have:

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>

I'm not getting any errors, just the red X for a missing image.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

风吹雪碎 2024-10-26 03:42:27

尝试删除

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

From index.php,并添加

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

Before the Stroke 调用。

try removing the

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

From index.php, and add

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

Before the Stroke call.

南风起 2024-10-26 03:42:27

我尝试这样的事情并且有效:

//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"); 

?>
///////////////////////////////////

I try something like this and works:

//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"); 

?>
///////////////////////////////////
无所的.畏惧 2024-10-26 03:42:27

我刚刚让它为我工作,我在 HTML 文件中添加了注释包含功能:

<?php //include ('my.php'); ?>

I just got it working for me I had comment include function in HTML file:

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