This article mainly introduces the practical points of curd application in Thinkphp and attaches simple examples. It is a very good article. Recommended to everyone here.
This time I have nothing to do but write about the specific application of curd. Of course, I mainly talk about curd here. What I do is the addition, deletion, modification and checking of users, and I don’t use the three major automatics
First of all
The code is as follows:
Show all users, registered on the homepage
The code is as follows:
Then there is our deletion method. It is very simple. The idea is like this. We can get the ID and delete the ID.
The code is as follows:
{
$this->success(‘Deletion successful’);
}
That’s it
How to add users
The code is as follows:
Updating a user is like this: We select the user based on the ID and output the user's information
The code is as follows:
Then updating makes it easier for users. Just save
The code is as follows:
This is it. These parts can complete the user's addition, deletion, modification and query. In fact, it is simple. The functions are added by ourselves, such as
How many times have we logged in to the forum? How is it done? In fact, one setInc can solve the problem of logging in once. 1 This way the login is output
Just a few times
That’s all for today