thinkphp PHP Framework Learning Note _php Tutorial

Source: Internet
Author: User
It took two more minutes to watch. thinkphp framework, don't want to be too deep to know all the advanced theories of it. Simply want to know how to use it, you can quickly build a website. So there is a choice to see, after two minutes or confused. So decided to change the learning strategy, on the official forum to see other people write the folk course, and indeed more than the official popular easy to understand. http://bbs.thinkphp.cn/forumdisplay.php?fid=6 ( Official Forum)

thinkphp There are a number of functions that can be combined by parameter piecing togetherSql , as follows: $list = $test->findall (', $fields, ' id desc ', $p->firstrow. ', '. $p->listrows); While this patchwork approach simplifies ourSql statement, but this also requires that we remember a lot of function methods, I do not want to remember too many of these things, I feel sometimes rather than directly write a completeSql easy. Don't knowthinkphp There's no direct writeQq. after executionSelect the function method of the query? later learnedModel.class.php There's a way inside .Public Function query ($sql) can meet the requirements I want! It's used when paging.Query method skips the use of the FindAll method to realize the paging function.

See examples and tutorials are all for single-table operation, but in many cases we need to use multi-table joint operation. such as multi-table joint query, this time what should be done? thinkphp has taken this issue into consideration, and has been very thoughtful to help us arrange the associated queries and associated operations. I don't even bother about that! In fact, flexible use of the framework of some of the basic functions of the method, you can achieve correlation query and associated operations . There is no need to memorize a whole bunch of things that are messy.

data paging is often used in a function, TP this aspect is quite simple. Find a tutorial on the Internet ( http://bbs.phpchina.com/thread-52813-1-1.html ), I thought it would be very simple to write a TP paging program in this tutorial. I didn't think it was quite a bother!

① At first, I met Fatal Error : Class ' Think ' not found in ... . error tip, find a generalist on the web to know that an extension class library is missing. The corresponding documents were later downloaded on the official website.

② extension class library has, did not prompt the error, can still not display the desired result correctly! View " page trace information Sql There is a problem select COUNT () as Tp_count from ' think_ Demo ' LIMIT 1 $count = $test->count ("', ' id ') code has a problem , $count = $test->count (' id ') finally see the next page of hyperlinks. The letter is better than no book!

③ with the tutorial $list = $test->findall (', $fields, ' id desc ', $p->firstrow. ', '. $p->listrows); I'm not going to get the results I want, and I don't want to go into the details of how the various parameters of the FindAll method are used. It is then changed to $list = $test->query ("Select $fields think_demo ORDER BY id desc limit $p->firstrow, $p->listro WS ") . Run again, this time finally put out the paging!

http://www.bkjia.com/PHPjc/320731.html www.bkjia.com true http://www.bkjia.com/PHPjc/320731.html techarticle It took more than two minutes to look at the thinkphp frame, not to be too deeply aware of all its advanced theories. Simply want to know how to use it, you can quickly build a website. So there is ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.