代码之家  ›  专栏  ›  技术社区  ›  suresh

允许访问仪表板.php在CodeIgniter中没有登录的页面

  •  1
  • suresh  · 技术社区  · 7 年前

    这是我的.htaccess页面

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /pes/
    
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    
    2 回复  |  直到 7 年前
        1
  •  1
  •   vasilenicusor    7 年前

    在我看来,.htaccess文件应该如下所示:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /pes/
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
    

    必须在主控制器中检查对仪表板的访问,这取决于您如何设计逻辑。 application/config/routes.php 文件

        2
  •  0
  •   suresh    7 年前

       public fucntion index()
    { 
        if (!$this->session->userdata('is_logged')) {
          //function code
        }
    }