CI 验证码辅助函数

来源:互联网 发布:算法流程图 翻译 编辑:程序博客网 时间:2024/05/14 02:12

CI刚进门,在做验证码辅助函数的demo时,硬是出不来。归纳了下问题

$config = array(   'img_path' =>  './public/captcha/',   'img_url' => base_url('public/captcha/'),   'img_width' => 100,   'img_height' => 40,   'expiration' => 300);$cap = create_captcha($config);

无法获取cap的值, 可能原因是

  1. 确保img_path,img_url不为空
  2. 确保img_path是个正确路径,这里填写相对路径可能会返回空
  3. img_path必须可写,windows服务器不存在这个问题
  4. GD库没有启用
GD库在php.ini中修改 去除extension=php_gd2.dll前的;
重启apache即可
0 0