ThinkPHPphp framework learning notes. It took more than two minutes to look at the ThinkPHP framework. I don't want to know all its advanced theories too deeply. Just want to know how to use it, you can quickly build a website. So I spent more than two minutes watching ThinkPHP Framework, do not want to know all its advanced theories too deeply. Just want to know how to use it, you can quickly build a website. So there is a choice. after two minutes, it is still confused. So I decided to change my learning strategy. I went to the official forum to read other popular folk tutorials, which were much easier to understand than the official ones. Http://bbs.thinkphp1.cn/forumdisplay.php? Fid = 6 ( Official Forum)
ThinkPHP Many functions are combined by parameters.SQL , As follows: $ List = $ test-> findall ('', $ fields, 'id desc', $ p-> firstRow. ','. $ p-> listRows ); Although this patchwork method simplifies USSQL Statement, but this also requires us to remember a lot of function methods. I don't want to remember too many such things. sometimes it is better to write a completeSQL Easy to use. UnknownThinkPHP Is there a direct write?SQL Run laterSelect Query function method? Later I learned thatModel. class. php There is a method in itPublic function query ($ SQL) Can meet the requirements I want! Used for pagingQuery Method skipped Findall Method to implement the paging function.
After reading the examples and tutorials, we operate on a single table. in many cases, we need to perform multi-table union operations. For example, how should I perform multi-table joint queries?ThinkPHPThis issue has been taken into account, and we have carefully arranged associated queries and operations. These are all too troublesome! In fact, the flexible use of some basic function methods in this framework can achieveAssociated queries and associated operations. There is no need to remember a lot of messy things.
Data paging is a frequently used function, and TP is quite simple. I found a tutorial on the Internet ( Http://bbs.phpchina.com/thread-52813-1-1.html), I thought it would be very easy to write a TP paging program by referring to this tutorial. I did not expect it to take a long time!
① First encountered Fatal error: Class 'think 'not found in .....The error message is that an extension class library is missing after you find a link on the Internet. Then, the corresponding files were downloaded from the official website.
② If the extension class library is available and no error is prompted, you still cannot display the expected results correctly! View"PageTraceInformation", It turns out to beSQLProblematic Select count () AS tp_count FROM 'Think _ Demo' LIMIT 1, Analysis to get this sentence of the tutorial$ Count = $ test-> count ('', 'id ')Code Problems,Change$ Count = $ test-> count ('id ')The hyperlink on the next page of the previous page is displayed. Believe in books as well as have no books!
③ Tutorial $ List = $ test-> findall ('', $ fields, 'id desc', $ p-> firstRow. ','. $ p-> listRows );I can't get the desired result for this code, and I don't want to know more about it.FindallMethod. Change $ List = $ test-> query ("select $ fields from think_demo order by id desc limit $ p-> firstRow, $ p-> listRows "). Run again. The page is finally rolled out this time!
The ThinkPHP framework does not want to know all its advanced theories too deeply. Just want to know how to use it, you can quickly build a website. So there is...