在index.php页面中用下面语句显示图像
echo "<img src='aaa.php' width='540' height='540'>"aaa.php程序如下:
<?phpglobal $rec;function open($imgurl)
{
    $rec=Imagecreatefromjpeg($imgurl);
}function show()
{
    header("Content-type: image/jpeg");
    imagejpeg($rec);
}open("./001.jpg");
show();?>现在这样写图像显示不出来,但如果把open和show两个函数合写成一个就没问题,那么为什么运行到show时,前面$rec获得的图像资源无法保留?