【问题标题】:htaccess configuration - With CodeIgniter - A3M libraryhtaccess 配置 - 使用 CodeIgniter - A3M 库
【发布时间】:2011-05-28 13:40:09
【问题描述】:

我下载了 a3m,它与 CI 1.7.2 一起打包,但我继续删除了它运行所需的所有文件,并将它们放入我预先存在的安装中。访问我网站上的 a3m 控制器后,我收到: 消息:未定义的属性:CI::$session

所以我认为这是因为 htaccess 在 a3m 文件夹中寻找 a3m 文件,这里是 a3m htaccess:

RewriteEngine on 
RewriteRule ^$ /a3m/index.php [L] 
RewriteCond $1 !^(index\.php|css|img|js|scripts|system|uploads|robots\.txt|favicon\.ico) 
RewriteRule ^(.*)$ /a3m/index.php/$1 [L] 

而我已经存在的用于 mod 重写的 htaccess 如下:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /beta/

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule> 

正如评论所显示的,我不久前在一个网站上使用过它,所以我想如何将两者结合起来我想是我想问的,因为我对使用 a3m 非常感兴趣。

谢谢大家。

【问题讨论】:

    标签: php .htaccess codeigniter oauth codeigniter-a3m


    【解决方案1】:

    您似乎没有加载会话库。

    如果您已加载库,请检查 system\application\config\autoload.php: [42] $autoload['libraries'] = array('database', 'session');

    您可以从控制器执行此操作: $this->load->library('session');

    http://codeigniter.com/user_guide/libraries/sessions.html

    【讨论】:

      猜你喜欢
      • 2016-01-05
      • 2012-06-27
      • 1970-01-01
      • 2017-11-23
      • 2012-06-08
      • 1970-01-01
      • 2012-10-27
      • 2016-04-14
      • 2014-09-08
      相关资源
      最近更新 更多