Maison >développement back-end >tutoriel php >php中文汉字验证码程序_PHP教程

php中文汉字验证码程序_PHP教程

WBOY
WBOYoriginal
2016-07-13 17:10:191118parcourir

本文章利用三个文件来简单的讲了一下关于php中怎么去应用中文验证码,中文因为是汉字可能出现乱码所以我们就定义了一个文件来专门处理,有需要的朋友可以参考下。

 代码如下 复制代码


/*   
* 文件:chinesechar.php   
* 作用:汉字数据储存   
*/   
$ChineseChar = array("人","出","来","友","学","孝","仁","义","礼","廉","忠","国","中","易","白","者","火 ","土","金","木","雷","风","龙","虎","天","地",   "生","晕","菜","鸟","田","三","百","钱","福 ","爱","情","兽","虫","鱼","九","网","新","度","哎","唉","啊","哦","仪","老","少","日",   "月 ","星");   
?>   

/*   
* 文件:check.php   
* 作用:验证   

*/   
session_start();   
$errorMSG = '';   
//验证用户输入是否和验证码一致   
if(!is_null($_POST['check']))   
{   
        if (strcasecmp($_SESSION['code'],$_POST['code'])==0)   
            $errorMSG = "

验证成功!

";   
        else   
            $errorMSG = "

验证失败!

";   
}   
?>   
   
   
   
   
   
if($errorMSG){   
echo $errorMSG;   
}   
?>   
method=post>   
璇疯
Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn