日期:2014-05-16 浏览次数:20503 次
<?php
/*
* 生成验证码图片
* author yuanjiang @2.16.2014
*/
define("IN_WD",true);
require('includes/init.php');
$sessionid = session_id();
$url = CLIENT_HOST.'createCaptcha.php';
$keyArr = array('sessionid'=>$sessionid);
$captcha = $Common->file_post($url,$keyArr);
echo base64_encode($captcha); //图片的base64编码,供客户端和web调用
?>
<?php
/*
* 生成验证码图片
* author yuanjiang @2.16.2014
*/
define("IN_WD",true);
$sessionid = isset($_POST['sessionid']) ? $_POST['sessionid'] : '' ; //根据post的sessionid切换session状态
if(!empty($sessionid))
{
session_id($sessionid); //执行这一步的时候程序会卡死,当$sessionid不等于页面A.php的session_id时正确
}
session_start();
require('includes/cls_captcha.php');
$Captcha = new Captcha;
$Captcha->generate_image(); //生成图片
?>