<?php
session_start();
$table = array(
'a0'=>'狗',
'a1'=>'鸟',
'a2'=>'猫',
'a3'=>'蝴蝶',
);
$index = rand(0,3);
$value = $table['a'.$index];
$_SESSION['authcode'] = $value;
$filename = dirname(_FILE_).'\\a'.$index.'.jpg';
$contents = file_get_contents($filename);
header('content-type:image/jpg');
echo $contents;
?> 以上是我的captcha_img.php 的代码,为什么在浏览器访问时,一直处于‘转圈’中,都显示不出来。。,那个神哥哥给看看。
刷新状态?会不会是图片太大了,换个小的试试?
另外建议改写
$contents = file_get_contents($filename);
ob_clean();
header('content-type:image/jpg');