0

I cloned a copy of Codeigniter from github today using this link: https://github.com/bcit-ci/CodeIgniter.git. I am currently running MAMP setup so that http://localhost:8888 points to my htdocs folder. My root folder is called 'time'. When I go to http://localhost:8888/time/index.php, I do see the Codeigniter welcome page. Also, I can go tohttp://localhost:8888/time/ and see the same welcome page, even though I don't have an .htaccess file in the root directory.

Here is the problem. I added the following function to the Welcome.php controller class:

public function test()
{
    echo 'Test';
}

This should display a page which shows 'test' when I visit http://localhost:8888/time/index.php/test. However, I get a 404 page not found error. Does anyone have any suggestions for understanding and fixing this problem?

1 Answer 1

1

Because localhost/index.php/test doesn't refer to the method test in the welcome controller. You would have to go to localhost/index.php/welcome/test or use routes.

They way you are doing it implies there is a controller named Test.php and it is trying to go to the index() function of that controller.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.