Home  >  Article  >  Backend Development  >  codeigniter - How to learn more about a PHP framework

codeigniter - How to learn more about a PHP framework

WBOY
WBOYOriginal
2016-08-18 09:16:28994browse

Used symfony,phalcon. Now I just used codeigniter, and I have some understanding of the PHP framework. But I always feel that I am still at a very shallow level of use. How can I understand these frameworks in depth, or write a framework myself?

Reply content:

Used symfony,phalcon. Now I just used codeigniter, and I have some understanding of the PHP framework. But I always feel that I am still at a very shallow level of use. How can I understand these frameworks in depth, or write a framework myself?

A framework is a set of specifications. No matter what components, plug-ins, and tools are used in it, these are all at the "technical" level, and how data flows and is converted is the "Tao" level of the framework. Download the examples and try yourself Write examples, configure your IDE, X-Debug, etc., break points to figure out what kind of process it is, and speculate on how the author thinks and what problems he is trying to solve.

The framework is this: Those who follow me will prosper, and those who go against me will stay cool. Find out how to adapt to the author's ideas and the boundaries of the problem that he can adapt to, and you will have thoroughly studied it.

Nothing is better than reading source code.

Read more code, there are no shortcuts

Start with the entry file and study how the framework operates.

  1. How the framework loads the global configuration file

  2. How the framework implements routing

  3. The framework encapsulates the database factory

It is best if you complete two different types of projects without using a framework, and then look at the framework in turn and you will find:
Frameworks usually solve problems that have nothing to do with business logic encountered in project development.

It seems like a very simple sentence, but in fact many people don’t understand it, although many people have heard that using frameworks is to allow developers to focus more on business logic instead of stacking wheels.

In a project, there are business logic (such as ordering) and non-business logic (such as data storage). There are variable links in each link of the specific business logic (such as requiring 2 different user reviews, maybe 2, maybe 4 ) and immutable links (the review step is necessary), etc. These are not only the basis for selecting the framework, but also the basis for expanding the framework.

It has a somewhat imaginative and indescribable meaning, I don’t know if you can understand it.

Actually, your idea is not a good one. You should have a deeper understanding of PHP. The framework may be slightly easier to use than the native PHP, but the speed of the framework is basically faster than your learning speed. Therefore, instead of understanding the framework in depth, it is better to learn PHP in depth and understand more basic things, so that you can learn any framework quickly in the future.

Recently, I have written my own framework and developed a multi-device intelligent interactive system, which is something I have always wanted to do. My method of developing the framework is very simple. If I continue as usual, there are various conventions to abide by. After a long time of accumulation of technology and experience , when I really made up my mind to do it, I found that there is only one principle: make it as simple as possible. Don’t think about it too complicated.
This framework development is similar to building a house with bricks. The sand, bricks, and tiles are piled neatly, and the ideas Once you sort it out, the rest is just hard work.

I have questions about this too! If you say use a framework, you can basically do it, but can you talk about having an in-depth understanding of this framework? I don’t think so!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn