As a front-end and php hacker, even mvc only stays in the state I have heard of. When I was just working on a website, the pressure was a little high. When I finally wrote it, the Code was suddenly written in a mess. A front-end page with a mix of php, js, and html code exceeded 1200 Lines. Long Ge said that the code is so arrogant that it cannot be tolerated as a person pursuing perfect code,
As a front-end and php hacker, even mvc only stays in the state I have heard of. When I was just working on a website, the pressure was a little high. When I finally wrote it, the Code was suddenly written in a mess. A front-end page with a mix of php, js, and html code exceeded 1200 Lines. Long Ge said that the code is so arrogant that it cannot be tolerated as a person pursuing perfect code,
As a front-end and php hacker, even mvc only stays in the state I have heard of. When I was just working on a website, the pressure was a little high. When I finally wrote it, the Code was suddenly written in a mess. A front-end page with a mix of php, js, and html code exceeded 1200 Lines. Long Ge said that the code style was so great that he could not bear to pursue perfect code, we can only refer to refactoring-improving the design of existing code at the bottom of a stack of books to start code refactoring.
First, analyze your own code:
At the beginning, I used the yii framework, which is an mvc framework. However, I only put the control code under the controllers directory and put the front-end view page in the views directory, as for models, haha, This is a magic horse ......
However, my database query functions and various processing functions are written in a func class and coexist in the controllers directory. This file contains more than 2000 rows ...... well, I can't bear to look straight at it. I also found many js functions in the front-end code, and repeated js functions on multiple pages, repeated css styles, and mixed php code. I can't bear to read this code, find out the problem first, and then refactor it step by step!