在url调用时使函数未定义

Using Codeigniter, i call a public function[of my controller] from the url which is basically normal behavior of the framework. I'm passing 3 parameters as $a, $b, $c and as the function gets executed, it checks the parameters and goes according to it. Now, the problem is i do not want my function to be called from the url, when it is called it should go to 404 page. i do know that this can be achieved by adding private or protected, but the real problem is it should be accessed only through one of my own other functions and not by direct url. Any solutions are welcome.

HTTP route block works. But when i pass parameters, the function gets executed which is a security problem. Any idea how to block access?

You could use routing to block any http traffic to that controller/method and redirect to the 404 page.

In your routes.php file in the config folder, add the following

$route['controller/private_method'] = '{your 404 controller}';
$route['controller/private_method/(:any)'] = '{404 controller}';

The second rule caters for any number of parameters.

Why don't you pass a hidden secret variable to identify that you are calling this function and it isn't getting called from URL.