thinkphp連貫操作實(shí)例分析,thinkphp實(shí)例分析
Jun 13, 2016 am 09:20 AMthinkphp連貫操作實(shí)例分析,thinkphp實(shí)例分析
本文實(shí)例分析了thinkphp連貫操作用法。分享給大家供大家參考。具體分析如下:
一、常用連貫操作,可以接連使用但沒前后順序之分,后面一定要有方法select,updata,delete,find
1.where:幫助我們?cè)O(shè)置查詢條件
2.order:對(duì)結(jié)果進(jìn)行排序
復(fù)制代碼 代碼如下:
$arr=$m->order('id desc')->select();//字符串方法,默認(rèn)是asc升序排列,加desc改為降序排列?
$arr=$m->order(array('id'=>'desc','sex'=>'asc'))->select(); //數(shù)組方法
3.limit:限制結(jié)果
復(fù)制代碼 代碼如下:
limit(2,5)//從第2條取出5條?
limit('2,5')//字條串形式參數(shù)?
limit(10)//等同于limit(0,10)默認(rèn)是從0開始
4.field:設(shè)置查詢字段
復(fù)制代碼 代碼如下:
field('username as name,id') //傳字符,修改字段名?
field(array('username'=>'name','id')//傳數(shù)組查詢,修改字段名?
field('id',true) //獲取除了id以外的所有字段
5.table:表格
6.group:分組
7.having:與分組有關(guān)
二、補(bǔ)充
alias 用于給當(dāng)前數(shù)據(jù)表定義別名 字符串
page 用于查詢分頁(內(nèi)部會(huì)轉(zhuǎn)換成limit) 字符串和數(shù)字
join* 用于對(duì)查詢的join支持 字符串和數(shù)組
union* 用于對(duì)查詢的union支持 字符串、數(shù)組和對(duì)象
distinct 用于查詢的distinct支持 布爾值
lock 用于數(shù)據(jù)庫(kù)的鎖機(jī)制 布爾值
cache 用于查詢緩存 支持多個(gè)參數(shù)(以后在緩存部分再詳細(xì)描述)
relation 用于關(guān)聯(lián)查詢(需要關(guān)聯(lián)模型擴(kuò)展支持)字符串
validate 用于數(shù)據(jù)自動(dòng)驗(yàn)證 數(shù)組
auto 用于數(shù)據(jù)自動(dòng)完成 數(shù)組
filter 用于數(shù)據(jù)過濾 字符串
scope* 用于命名范圍 字符串、數(shù)組
希望本文所述對(duì)大家的ThinkPHP框架程序設(shè)計(jì)有所幫助。

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

To run the ThinkPHP project, you need to: install Composer; use Composer to create the project; enter the project directory and execute php bin/console serve; visit http://localhost:8000 to view the welcome page.

ThinkPHP has multiple versions designed for different PHP versions. Major versions include 3.2, 5.0, 5.1, and 6.0, while minor versions are used to fix bugs and provide new features. The latest stable version is ThinkPHP 6.0.16. When choosing a version, consider the PHP version, feature requirements, and community support. It is recommended to use the latest stable version for best performance and support.

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

PyCharm is a very popular Python integrated development environment (IDE). It provides a wealth of functions and tools to make Python development more efficient and convenient. This article will introduce you to the basic operation methods of PyCharm and provide specific code examples to help readers quickly get started and become proficient in operating the tool. 1. Download and install PyCharm First, we need to go to the PyCharm official website (https://www.jetbrains.com/pyc

Performance comparison of Laravel and ThinkPHP frameworks: ThinkPHP generally performs better than Laravel, focusing on optimization and caching. Laravel performs well, but for complex applications, ThinkPHP may be a better fit.

sudo (superuser execution) is a key command in Linux and Unix systems that allows ordinary users to run specific commands with root privileges. The function of sudo is mainly reflected in the following aspects: Providing permission control: sudo achieves strict control over system resources and sensitive operations by authorizing users to temporarily obtain superuser permissions. Ordinary users can only obtain temporary privileges through sudo when needed, and do not need to log in as superuser all the time. Improved security: By using sudo, you can avoid using the root account during routine operations. Using the root account for all operations may lead to unexpected system damage, as any mistaken or careless operation will have full permissions. and

ThinkPHP installation steps: Prepare PHP, Composer, and MySQL environments. Create projects using Composer. Install the ThinkPHP framework and dependencies. Configure database connection. Generate application code. Launch the application and visit http://localhost:8000.

Presumably many users have several unused computers at home, and they have completely forgotten the power-on password because they have not been used for a long time, so they would like to know what to do if they forget the password? Then let’s take a look together. What to do if you forget to press F2 for win10 boot password? 1. Press the power button of the computer, and then press F2 when turning on the computer (different computer brands have different buttons to enter the BIOS). 2. In the bios interface, find the security option (the location may be different for different brands of computers). Usually in the settings menu at the top. 3. Then find the SupervisorPassword option and click it. 4. At this time, the user can see his password, and at the same time find the Enabled next to it and switch it to Dis.
