是否有必要在模型中使用私有函数?

I'm making a model in CodeIgniter and I don't want any of the functions to be accessible to the user. For controllers you would do something like:

private function _myfunction()
{
    dosomething();
}

I know this will also work for models but my question is, is this needed? I don't think users can initiate these functions via the URL. The reason I'm asking is because I'd like to follow best practice but if possible I'd also like to avoid prefixing everything with '_' when I call it.

No, that is not necessary. It's an unusual situation for a user to have access to a class method through URL, and it's only implemented in codeigniter for controllers.

It's not necessary, and in fact prefixing private objects with "_" is depreciated with the actual use of the "private" and "protected" keywords in PHP 5+.

No its not necessary. To prevent access to the method from the browser, just add an underscore before the method: _method() . This is Ideal if you want to use/call it as a module(HMVC).