为了账号安全,请及时绑定邮箱和手机立即绑定

打开captcha_img.php需要下载?

<?php

//开启session

session_start();


//维护物料和值的关系

$table = array(

'pic0' => '狗',

'pic1' => '花',

'pic2' => '熊',

'pic3' => '田',

);


$index = rand(0,3);

$value = $table['pic'.$index];

$_SESSION['authcode'] = $value;


$filename = dirname(__FILE__).'\\pic'.$index.'jpg';

$contents = file_get_contents($filename);


header('content-type:image/jpg');

echo $contents;

?>

代码如上,用的猎豹浏览器,为什么需要浏览器告知需要下载"captcha_img.php"文件呢?

正在回答

2 回答

我也不是很清楚这个问题是为什么,但是我有一个疑问,你输出一个图像,用了header('content-type:image/jpg');

为什么还要echo $contents;

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

打开captcha_img.php需要下载?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信