ThinkPHP5 development (4) query the user list

Source: Internet
Author: User
Directory structure: 1. SQL script --phpMyAdminSQLDump--version4.4.15.5--www.phpmyadmin.net ---- Host: localhost -- GenerationTime: 2016-07-1223:05:40 -- Server version: 5.7.12-log -- PHPVersion: 7.0.

Directory structure:

1. SQL script

-- PhpMyAdmin SQL Dump -- version 4.4.15.5 -- http://www.phpmyadmin.net---- Host: localhost -- Generation Time: 2016-07-12 23:05:40 -- Server Version: 5.7.12-log -- PHP Version: 7.0.7SET SQL _MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+ 00:00 ";/*! 40101 SET @ OLD_CHARACTER_SET_CLIENT = @ CHARACTER_SET_CLIENT */;/*! 40101 SET @ OLD_CHARACTER_SET_RESULTS = @ CHARACTER_SET_RESULTS */;/*! 40101 SET @ OLD_COLLATION_CONNECTION = @ COLLATION_CONNECTION */;/*! 40101 set names utf8mb4 */; ---- Database: 'thinkphp5 '---- -------------------------------------------------------- TABLE structure 'think _ user' -- create table if not exists' think _ user' ('User _ id' int (11) not null, 'user _ name' varchar (255) not null, 'User _ sex' int (11) default null, 'User _ tel 'varchar (255) default null, 'user _ email 'varchar (255) default null, 'User _ address' varchar (255) default null, 'user _ Birth 'varchar (255) default null, 'User _ jointime' varchar (255) default null, 'User _ passwd' varchar (255) default null, 'user _ signature 'varchar (255) default null, 'User _ hopb' varchar (255) default null, 'status' int (11) not null) ENGINE = InnoDB AUTO_INCREMENT = 5 default charset = utf8mb4; ---- 'think _ user' -- insert into 'think _ user' ('User _ id ', 'user _ name', 'User _ sex ', 'User _ tel', 'User _ email ', 'User _ address', 'User _ birth ', 'User _ jointime', 'User _ passwd', 'User _ signature', 'User _ hoby', 'status ') VALUES (1, 'thinkphp', 1, '000000', 'emial @ email.com ', 'jinan city, Shandong province *** route', '000000', '000000 ', 'qqq', NULL, NULL, 1), (2, 'pangpython', 1, '123', 'Email @ emial.com ', 'jinan city, Shandong province', '123 ', NULL, '20140901', 'nihao', 'upper speed speed', 1), (3, 'test', 0, '20160901', 'pangpython @ 163.com ', 'Beijing Zhongguancun ', '19 931212 ', '000000', '21232f297a57a5a743894a0e4a801fc3', 'This person is very lazy, nothing to write ', 'smoking, drinking hot headers', 1), (4, 'What are you G', 0, '123', 'admin @ haha.com ', 'Silicon Valley', '123456', '63a9f0ea7bb98050796b649e85481845 ', 'personalized outlook ', 'pop-up', 1 ); ---- Indexes for dumped tables ------ Indexes for table 'think _ user' -- alter table 'think _ user' add primary key ('User _ id'); ---- AUTO_INCREMENT for dumped tables ------ AUTO_INCREMENT For table 'think _ user' -- alter table 'think _ user' MODIFY 'user _ id' int (11) not null AUTO_INCREMENT, AUTO_INCREMENT = 5 ;/*! 40101 SET CHARACTER_SET_CLIENT = @ OLD_CHARACTER_SET_CLIENT */;/*! 40101 SET CHARACTER_SET_RESULTS = @ OLD_CHARACTER_SET_RESULTS */;/*! 40101 SET COLLATION_CONNECTION = @ OLD_COLLATION_CONNECTION */;

2. write controller
User \ controller \ Members. php

 Where ('status', 1)-> limit (5)-> order ('User _ id', 'asc ') ;}); $ view = new View; // Set the variable output $ view-> assign ('list', $ list); return $ view-> fetch ('index ');}}

3. write View
User \ view \ members \ index.html

    Member    
 
 
Member {volist name = "list" id = "vo "}
{$ Vo. user_id} name: {$ vo. user_name}
{/Volist}

General Idea:
The front-end submits a query request to the controller. the controller queries the data based on the condition, replaces the variable with the view, and renders and returns...

The above is the ThinkPHP5 development (4) query details of the user list (text). For more information, see other related articles in the first PHP community!

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.