【发布时间】:2016-01-05 02:10:38
【问题描述】:
我正在项目中实施验证码。我正在使用 codeigniter 框架。在 captcha_helper.php 文件中的代码
$use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE;
返回 false。因为file_exists($font_path) 正在返回 false。
我路过
$img_path = '../../captcha/';
$img_url = base_url() . 'captcha/';
$font_path = base_url(). 'captcha/font/impact.ttf';
$captch = array(
'word' => '',
'img_path' => $img_path,
'img_url' => $img_url,
'font_path' => $font_path,
'img_width' => '200',
'img_height' => '50',
'expiration' => '300'
);
$cap = create_captcha($captch);
现在,当我回显$font_path并在浏览器中复制并粘贴相同的url时,提示字体文件是下载意味着路径是正确的。那么,为什么 file_exists($font_path) 会返回 false。
我尽力了也弄不明白。请帮助我,如果有任何愚蠢的错误,请原谅我。
【问题讨论】:
标签: php codeigniter captcha