CodeIgniter: Decision making for creating of library & helper in CodeIgniter

前端 未结 6 1402
孤街浪徒
孤街浪徒 2020-12-23 02:10

After developing in CodeIgniter for awhile, I find it difficult to make decisions when to create a custom library and when to create a custom helper.

I do understand

6条回答
  •  半阙折子戏
    2020-12-23 03:05

    First of all, you should be sure that you understand the difference between CI library and helper class. Helper class is anything that helps any pre-made thing such as array, string, uri, etc; they are there and PHP already provides functions for them but you still create a helper to add more functionality to them.

    On the other hand, library can be anything like something you are creating for the first time, any solution which might not be necessarily already out there.

    Once you understand this difference fully, taking decision must not be that difficult.

提交回复
热议问题