CodeIgniter – I have a public function in a controller but I don’t want people requesting it via a URL.
i.e., I have this:
public function process_images($images) {
...
}
Which I need to be public because I am using GroceryCRUD and using a callback – setting it to protected means that GroceryCRUD won’t call it using its callback.
So it looks like it has to be public. How do I declare it public but make sure that CodeIgniter doesn’t call it from a URL request (i.e., if I went to http://site.com/images/process_images/test.jp it wouldn’t call ::process_images('test.jpg'))
You can use underscore prefix:
This way it can remain public and codeigniter won’t call it on an URL request.
Documented here