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
Php codigniter 2.1.4和ion#u auth won';行不通_Php_Codeigniter_Authentication_Ion Auth - Fatal编程技术网

Php codigniter 2.1.4和ion#u auth won';行不通

Php codigniter 2.1.4和ion#u auth won';行不通,php,codeigniter,authentication,ion-auth,Php,Codeigniter,Authentication,Ion Auth,我尝试将ion_auth库用于codeigniter,但我无法让它工作。已在给定文件夹中创建相应的文件,mysql结构已创建 我的管理结构如下 controller --admin ---dashboard.php ---auth.php 我请求域/管理员/仪表板 我检查用户是否已登录 if (!$this->ion_auth->logged_in()) { redirect('admin/auth/login', 'refresh');

我尝试将ion_auth库用于codeigniter,但我无法让它工作。已在给定文件夹中创建相应的文件,mysql结构已创建

我的管理结构如下

controller
--admin
---dashboard.php
---auth.php
我请求域/管理员/仪表板 我检查用户是否已登录

  if (!$this->ion_auth->logged_in()) {
            redirect('admin/auth/login', 'refresh');
        }
其他人应该能够访问仪表板

在我看来,我没有

--view
---admin
---- tmpl
-----index.php
---auth
----login.php
然后我尝试使用默认凭据登录

失败,但我甚至没有收到错误消息。然后我检查了controller/admin/auth.php登录方法

    if ($this->form_validation->run() == true)
    { 
        codes that would check credentials

    } else
    {
        $this->data['message'] = (validation_errors()) ? validation_errors() :    $this->session->flashdata('message');
        //and return to login view
    }
我尝试var_dump($this->data['message']),但得到布尔值false

深入一点,我在/sytem/libraries/form_validation.php下检查表单验证器

if (count($_POST) == 0)
        {
            return $this;
        }

var_dump(count($_POST));
显示已发布的数据
0

好的,让它开始工作
忽略来自框架的表单模板修复了我最近在8月7日在CI 2.1.4中使用的Ion auth的问题,没有问题。由于您没有收到任何验证消息,我怀疑您没有添加
ionauth
的语言文件夹,也没有加载

验证控制器最近更新为使用

因此,除非加载语言文件,否则您不会收到任何消息

如果是这样,我建议在config/autoload.php中自动加载语言助手

并将所需的语言文件从Ion auth languages文件夹复制到CI language文件夹中

这应该可以解决问题

$autoload['helper'] = array('language');