简体   繁体   English

未触发CodeIgniter控制器功能

[英]CodeIgniter controller functions not triggered

In CodeIgniter, my url someurl.com/test/ will not execute anything inside the controller class. 在CodeIgniter中,我的URL someurl.com/test/将不会在控制器类内执行任何操作。 Please take a look and tell me if there's something you can think of that might prevent the execution of the CI_Controller here or where I should look. 请看看并告诉我是否有什么事情可以阻止CI_Controller在此处或在我应该看的地方执行。

For example the following 例如以下

some.testurl.com/test/hi/Bob
some.testurl.com/test
some.testurl.com/test/hi

all show: 全部显示:

Above class
Below class

EDIT: I believe my issue is with how I'm trying to run two separate applications. 编辑:我相信我的问题是我试图如何运行两个单独的应用程序。 One is at testurl.com and the other is some.testurl.com where the directory for some.testurl.com is a subfolder of the directory where testurl.com is held. 一个是在testurl.com ,另一个是some.testurl.com其中用于目录some.testurl.com是所在目录的子目录testurl.com举行。 What's the right way to do this that they both work? 它们都起作用的正确方法是什么?

Update: Moving the subdomain outside the other CodeIgniter application's directory hasn't changed the behavior in any way. 更新:将子域移到另一个CodeIgniter应用程序目录的外部没有任何改变。 The CodeIgniter controller does not do anything. CodeIgniter控制器不执行任何操作。

Here's my code: 这是我的代码:

<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

    echo "Above class<br>";

    class Test extends CI_Controller {
    public function __construct() {
        parent::__construct();
        $this->load->model('mod_login');
        $this->load->helper('date');

        }
//443 replace with 482
    function index() {
        echo "Index function";
    }

    function hi($name)
    {
        echo "Hi".$name."!";
    }
}

echo "Below class<br>";
?>

Here's my .htaccess file: 这是我的.htaccess文件:

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|common|ico|database_backup|images|img|js|scripts|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
  1. Error reporting is enabled already and no errors are triggered. 错误报告已经启用,没有错误被触发。 Environment is defined as development on the index file. 环境定义为在索引文件上进行开发。

This may be a mod_rewrite issue. 这可能是mod_rewrite问题。 Check your php info to see if the module is installed and running on the apache server. 检查您的php信息,以查看该模块是否已在apache服务器上安装并运行。

If there is, check you httpd.conf file at <Directory "C:/PATH/TO/YOUR/APP"> directive, where it should exist AllowOverride All . 如果存在,请在<Directory "C:/PATH/TO/YOUR/APP">指令中检查httpd.conf文件,该文件应位于其中AllowOverride All

A missing curly bracket in database.php broke the whole application without triggering an error message. database.php中缺少花括号,导致整个应用程序中断,而没有触发错误消息。 I'm sorry because no one could ever guess it. 对不起,因为没有人能猜到。 It's not the type of error I expected to cause this problem because I verified that environment was development and I triggered lots of other errors in my quest to fix this. 这不是我希望引起此问题的错误类型,因为我验证了环境是开发环境,并且在寻求解决此问题时触发了许多其他错误。

If someone else runs into this, just know it could be a simple error in any of the config files. 如果其他人遇到此问题,只需知道这可能是任何配置文件中的简单错误。

Thanks everyone. 感谢大家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM