Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6917169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:41:47+00:00 2026-05-27T09:41:47+00:00

I created the file MY_Router.php inside the core directory with this code: <?php class

  • 0

I created the file MY_Router.php inside the core directory with this code:

<?php
class MY_Router extends CI_Router {

    function MY_Router()
    {
        parent::CI_Router();
    }

    function _validate_request($segments)
    {
        // Comprueba que el controlador no existe
        if (!file_exists(APPPATH.'controllers/'.$segments[0].EXT))
        {
            $segments = array("page", "load", $segments[0]);

        }
        return parent::_validate_request($segments);
    }
}
?>

When I call the application, this error appears:

Fatal error: Call to undefined method CI_Router::CI_Router() in /home/david/public_html/CodeIgniter_2.1.0/application/core/MY_Router.php on line 6

Where is the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:41:47+00:00Added an answer on May 27, 2026 at 9:41 am

    The problem is that there is no method in the CI_Router class called CI_Router(). In PHP4, constructors have the same name as the class. In PHP5, constructors are named __construct().

    To fix the issue, change the constructor in the MY_Router class from

    function MY_Router()
    {
        parent::CI_Router();
    }
    

    to

    function __construct()
    {
        parent::__construct();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I created two file to switch my forum (Language Chinese and English) enForum.php
I have created a file named MyFile.db using SQLite3 from my C#.net application. This
I have created a custom Magento module which extends the core sales order functionality
In my python script i am parsing a user created file and typically there
I created an App.config file in my WPF application: <?xml version="1.0" encoding="utf-8" ?> <configuration>
For some reason my Tinyxml file which is created via visual studio 2005 (c++)
I know that when a war file is created of my web application, i
I've created my own application in VB.NET that saves its documents into a file
i have published my project and exe file has been created.... now i want
I am creating a custom module in magento.I have created block class and phtml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.