Teneff
Teneff

Reputation: 32158

How to ensure that CodeIgniter controller and action exists

I have to create a function that will check whether CodeIgniter's controller and action exists. The framework has non-reusable method Router::_validate_request() which checks whether the file exists, but I don't like it :)

I'm trying to figure out what is the best way since they don't use any autoload functions and php's class_exists and method_exists are useless.

Upvotes: 0

Views: 964

Answers (1)

minboost
minboost

Reputation: 2563

You can write a custom function that uses file_exists (like in Router::_validate_request()) and then use ReflectionClass to find the method.

Upvotes: 1

Related Questions