我有一个类名“MonthReport.class.php”,其结构如下:
class MonthReport{
.....
//some member variables
public function pieChart(){
........
//the image data comes from mysql and data belongs to a specified user
$myPicture->Stroke();
}
public function lineChart(){
........
//the image data comes from mysql and data belongs to a specified user
$myPicture->Stroke();
}
public function render html(){
$html.=str1<<<
.....
//some html code
str1;
$html.=<<<str2
<img src="$this->pieChart()" /> //can not work
str2;
}
}
当我在 src 位置调用 pieChart() 函数时,它将覆盖我的整个页面并仅显示图像。我该怎么做?我尝试在单独的页面中呈现图像,但图像需要一些指定的用户数据,例如'userId'。换句话说,当我新建一个对象时,它指定了 userId,因此我无法在单独的页面中呈现图像。对不起我的英语不好!但我需要你的帮助!谢谢你!