How to set private class to form validation callback in codeigniter How to set private class to form validation callback in codeigniter codeigniter codeigniter

How to set private class to form validation callback in codeigniter


You can just declare your private function as you have already done:

function _username_check(){  // some code}

And in the validation rule, use:

callback__username_check

As I have seen, this must work just fine!

Remember:

The _ prefix would take care of your function privacy, so you do not really have to use the keyword private to declare the function to let the form_validation class access to that function!