Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
已删除captcha文件夹中的CodeIgniter-.htaccess文件_.htaccess_Codeigniter_Captcha - Fatal编程技术网

已删除captcha文件夹中的CodeIgniter-.htaccess文件

已删除captcha文件夹中的CodeIgniter-.htaccess文件,.htaccess,codeigniter,captcha,.htaccess,Codeigniter,Captcha,我在根目录中的WAMP上安装了CodeIgniter。问题来了:我一直在尝试验证码。我的验证码文件夹是C:\wamp\www\captcha。问题是,当生成新的验证码时,验证码中的.htaccess文件会被删除 .htacces文件的内容是: RewriteEngine on RewriteRule !.*\.jpg - [F,L] RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRul

我在根目录中的WAMP上安装了CodeIgniter。问题来了:我一直在尝试验证码。我的验证码文件夹是
C:\wamp\www\captcha
。问题是,当生成新的验证码时,验证码中的.htaccess文件会被删除

.htacces文件的内容是:

RewriteEngine on 
RewriteRule !.*\.jpg - [F,L]

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*) - [F]
我使用它返回一条
禁止的….
消息,如果。jpg文件存在

目前我在/view文件中只有这个。我还没有实现任何检查/提交方法。我觉得我需要先克服这一点

$this->load->helper('captcha');
$vals = array(
    'img_path' => './captcha/',
    'img_url' => 'http://localhost/captcha/',
    'img_width' => '150',
    'img_height' => 30,
    'expiration' => 25
    );

$cap = create_captcha($vals);
echo $cap['image'];

提前谢谢。

答案其实很简单:只需在
验证码
中创建一个文件夹(在我的例子中是
图像
),并相应地编辑文件:

.htaccess(在
captcha
文件夹中)

其他“查看”文件

$this->load->helper('captcha');
$vals = array(
    'img_path' => './captcha/images/',
    'img_url' => './captcha/',
    'img_width' => '150',
    'img_height' => 30,
    'expiration' => 3600
    );

$cap = create_captcha($vals);
echo $cap['image'];
$this->load->helper('captcha');
$vals = array(
    'img_path' => './captcha/images/',
    'img_url' => './captcha/',
    'img_width' => '150',
    'img_height' => 30,
    'expiration' => 3600
    );

$cap = create_captcha($vals);
echo $cap['image'];