I have recently seen a lot of OOP teaching mysqli (or PDO), found it to be a new world). The way I now connect to databases and statements is to introduce a large php file on each page, including links, and there are many small php files, which may be functions, or mysql statements, and use switches to set which page will be used. Until I got to know OOP, I found that there are many programs to optimize, but I have a lot of problems in mind.
I want to replace the old writing with a new one. I just don"t know where to start, so there seems to be a lot of improvement.
, including my css,js, uses a php file to introduce
, so there will be at least two introductions on each page. One may be header.php and the other is footer.php
, and there are a lot of php in it. This at least ensures that every page is Synchronize accessible, but I"m not sure it"s right. The functions that are useful are reintroduced, and those that are not used are not introduced.? . Wait
- what is the concept that php is separated from html?
- I do not currently use the framework, so now the way the site is written is old, due to time pressure, it is impossible to get rid of retraining, but at least I want to slowly change the logic of the framework to the current site, the first thing I think of is to connect the database interaction, in the past I was the above declaration statement, the following is while ($row = mysqli_fetch. The method of writing to fish out the data will almost be accompanied by html, rather than pure json format. How can this method be incorporated into the concept of OOP and improved?
- I have watched a lot of OOP film teaching, and everyone"s OOP mysqli writing is almost different. What I want to make sure is how do you write it? I just want to find the safest way to write it. (my goal is to make my code accessible to others.)
- useful class functions are re-introduced, not used will not be introduced, so I found the concept of namespace, but I still do not understand this movement logic, even if I have read the real-time coding, but do not know how to apply to the current old writing, I do not know if there is a great recommendation or experience to replace the writing?
I find that there are more functions, and it is not right for each page to introduce features that are not needed to think about it. The more you switch.. It is getting uglier and uglier. So I decided to send an article to ask about the experience of the great gods. Thank you for sharing. Thank you very much