0

When I use Class Hello extends CI_Controller in the CodeIgniter framework, everything runs fine. But when I run Class Hello extends Controller, I get the following error:

Fatal error: Class 'Controller' not found in C...... on line 2

Anybody know whats going on? Is the Controller class in CodeIgniter deprecated or something of that nature?

2
  • Controllers must extend CI_Controller, that's the name of the controller's core class. Commented Nov 17, 2011 at 1:10
  • Hmm, so why in tutorials they reference Controller, and it works on their servers, but when I write the same code and run it on my server it crashes with Fatal Errors? Commented Nov 17, 2011 at 1:19

2 Answers 2

2

doesn't appear so, the latest doc link http://ellislab.com/codeigniter/user_guide/general/controllers.html

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

2 Comments

it appears you have it reversed, Controller was prior to CodeIgniter v2.0 and now it's CI_Controller, here's a dupe post: link
Okay, so it's been replaced? That's what I figured. Thanks man.
1

Yea, you need to extend CI_Controller, like:

class Hello extends CI_Controller { 

If it would have been in versions prior to 2.0.0, your

class Hello extends Controller {

would have worked. Hope it helps

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.