I work with CodeIgniter. There is a controller Controller in which there are several functions - function1, function2 ... The first is called from the address bar, and function 2 from function1.
How to close access to function2 from the address bar ???

  • remove action from the name? or whatever ... I do not remember already - johniek_comp

1 answer 1

Judging by the documentation CodeIgniter, in order that the function can not be called from the request, it is enough to add the bottom dash to its name . There is also an example:

function _function2(/* параметры */) { /* код */ } 

I do not know how CodeIgniter will respond, but another logical solution to this problem may be to declare it as protected or private . The call from the inside is, of course, not affected. But to call it outside is no longer possible. Something like that:

 protected function function2(/* параметры */) { /* код */ }