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 7748915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:54:29+00:00 2026-06-01T10:54:29+00:00

I am having the strangest time with the following PHP code. The require_once runs

  • 0

I am having the strangest time with the following PHP code. The require_once runs in the else statement even though the if statement is true. What is also strange is that $controller in the else statement recieves the value of “application.” There is no other code related to the following other than $total’s value.

    $total = $uri->total();

    if($total == 0) {

        //Home Page Controller
        $controller = 'index';
        $method = false;

    } else {

        $controller = $uri->segment(1); //value is "account"

        if($uri->segment(2) !== false) {
            $method = $uri->segment(2); //value is "login"
        } else {
            $method = false;
        }
    }

    require_once(APPPATH.'controllers/'.$controller.EXT);

    $$controller = new $controller;

    if($method != false) {
        $$controller->$method();
    } else {
        $$controller->index();
    }

Edit: I fixed the double-code so that the same code is not called twice in either the if or the else. When I run this, the code works, but I get an error on the line where the require_once is: cannot find application.php

This is strange because require_once is already loading the correct class, but I am getting an error that it cannot find the right file. What would cause it to load twice? I’ve checked to make sure the file this PHP is in doesn’t load twice.

This is all the code I am working with except the URI class found here: https://github.com/chrisabrams/PHP-URI-Class

I am not sure where application.php comes from.

  • 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-06-01T10:54:31+00:00Added an answer on June 1, 2026 at 10:54 am

    This has been resolved: http://codeigniter.com/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a strange problem with php PDO and mysql. I have the following
I'm having a strange problem. I have the following code: dbg(condwait: timeout = %d,
Having a strange issue with some C# code - the Getter method for a
I'm experiencing the strangest problem and have been having a terrible time debugging it.
I am having strange problem, whenever my site is loaded for the first time
I am having a strange compile time error message when attempting to compile one
I am having a strange problem with PHP and a C script that uses
I am having the strangest problem ... every time i commit i get and
I'm having a strange time dealing with selecting from a table with about 30,000
I'm having a strange problem when debugging some java code with eclipse (Version: Helios

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.