demo01.php<form action="demo03.php" method="POST">
<img src="http://192.168.1.11/rand.php"><br>
<input type="text" name="www"><br>
<input type="submit" value="click">
</form>  rand.php<?php
header("Content-type: image/PNG");
session_start();//将随机数存入session中
$_SESSION['random']="";
$im = imagecreate(35,15); //制定图片大小$black = ImageColorAllocate($im, 0,0,0); //设定颜色
$white = ImageColorAllocate($im, 255,255,255);imagefill($im,0,0,$white); //区域填充$authnum = rand(1000,9999);
//将四位整数验证码绘入图片
$_SESSION['random']=$authnum;
imagestring($im, 5, 0, -1, $authnum, $black);for($i=0;$i<100;$i++) //加入干扰象素
{
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}ImagePNG($im);
ImageDestroy($im);
?>
demo03.php<?php
session_start();$a=$_SESSION['random'];
$b=$_POST['www'];
echo $a."<br>".$b;?>在demo01.php中<img src="">,路径写localhost没有问题,如果把路径改成http://192.168.1.11(我的局域网ip),验证码图片能够读出来,但是session就取不到了 不知道为什么 大家帮忙看下 谢谢