A beginner learns the CI framework and has some common modules. To reduce the granularity, I want to encapsulate it. I wonder if you have any good and mature experience? A beginner learns the CI framework and has some common modules. To reduce the granularity, I want to encapsulate it. I wonder if you have any good and mature experience?
Reply content:
A beginner learns the CI framework and has some common modules. To reduce the granularity, I want to encapsulate it. I wonder if you have any good and mature experience?
Based on my practical experience, writing a separate model is the easiest way for beginners to understand.
Models can call each other, accept post data, and almost accept all operations of the controller, which also avoids the exposure risk of the controller. Of course, at least two lines of code are required for calling.
$ This-> load-> model ('safe '); $ this-> safe-> login (); // you can perform a jump operation under the login function in the safe model.
In fact, writing a library is the best choice for large projects, but it is difficult for new users to understand and operate. You can try the model first and then the library.
Written in the model or under libraries
You can put these things in a public control or library. For this information, you can go to the CI official website to find more information.
Write a public Control, integrate the verification module, and then the other Control inherits it