简体   繁体   中英

CodeIgniter controller functions not triggered

In CodeIgniter, my url someurl.com/test/ will not execute anything inside the controller class. 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.

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. 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. The CodeIgniter controller does not do anything.

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:

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. Check your php info to see if the module is installed and running on the apache server.

If there is, check you httpd.conf file at <Directory "C:/PATH/TO/YOUR/APP"> directive, where it should exist AllowOverride All .

A missing curly bracket in database.php broke the whole application without triggering an error message. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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