【问题标题】:CodeIgniter: The configuration file ion_auth.php does not exist.CodeIgniter:配置文件ion_auth.php不存在。
【发布时间】:2015-03-05 09:50:55
【问题描述】:

我的项目中一直使用的模块是用 CodeIgniter 编写的。

我有什么

Folders
-->application
  -->cache
  -->config
     -->config.php (configuration file for auth, I copied the codes to config.php)
  -->controllers
  -->core
  -->errors
  -->helpers
  -->hooks
  -->language
  -->libraries
     -->auth's libraries files.
  -->logs
  -->models
  -->modules
     -->admin
        -->controllers
           -->auth.php
        -->models
           -->ion_auth_model.php
        -->views
           -->auth
               -->login.php
     -->home
  -->third_party
  -->views
-->assets
-->system

问题是什么

当我转到 localhost/home/auth/login.php 时,出现错误消息。屏幕上写着

遇到错误

配置文件ion_auth.php不存在。

我猜问题是关于 iounauth 配置文件将在设置之前移动到 config 文件夹。我没有将其移至配置文件夹。取而代之的是,我将该文件中的所有代码复制到了 config.php

那么我该如何解决这个问题呢?我需要查看登录屏幕而不是此错误消息。我想我应该在 controller 文件夹中更改 auth.php 上的一些行。因为我在 config 文件夹中使用 config.php 而不是 ionauth.php。

【问题讨论】:

  • 加载自定义库有很多常见问题,首先,检查库是否已加载,尝试使用 $this->load->library('ion_auth'); 将其加载到您的控制器上在codeigniter的自动加载配置文件中加载它,检查类是否用Capitalize声明,如果您使用的是Codeigniter 3请阅读更改,有很多更改,传统的库加载确实发生了变化!
  • 我检查了你所说的一切,但没有任何改变
  • ion_auth.php 是否存在于文件夹配置中?另外,为什么你不制作自己的身份验证库?比 ion_auth 容易得多。
  • 在这里查看 ion_auth 的文件和文件夹的结构,并与您的github.com/benedmunds/CodeIgniter-Ion-Auth进行比较
  • 只是出于好奇,不使用config文件夹中的ion_auth.php的原因是什么?另外,对于复制的配置,您是直接从ion_auth.php 复制还是在所有数组声明前添加了['ion_auth'] 索引?

标签: php codeigniter ion-auth


【解决方案1】:

我刚刚快速浏览了 ion_auth 库和模型,最简单的做法是:

  1. 从库和模型中删除 $this->load->config('ion_auth', TRUE);

  2. 在库和模型中进行字符串替换:

查找:, 'ion_auth') 替换为:)

我已经对文件进行了快速扫描,但我看不到任何会破坏任何东西的地方,但是当你这样做时要小心(可能一次只做一个)。

上述步骤应该允许您在config.php 中使用 ion_auth 配置项

请注意,我没有对此进行测试。

希望这会有所帮助!

【讨论】:

    【解决方案2】:

    将我的网站移动到 linux 服务器时,我也遇到了这个问题,通过将 config/Ion_auth.php 重命名为 config/ion_auth.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-03
      • 1970-01-01
      • 2015-09-19
      • 2014-10-26
      相关资源
      最近更新 更多