Home >Backend Development >PHP Problem >How to create php like function
How to create the like function in php?
First, clarify the logic of creating tables, two tables. A data table for likes, and a table that records the status of likes; if there is no data in the likes table, add likes, and if there is data, query
Get likes Return to the status without giving likes
The red background is output if there are no likes, and there is no data in the like status table
The like is successful. Add the like status to the like status table and return the output status
PHP data of the number of likes. The number of likes is increasing, but the status of the likes is It is necessary to record according to the user id and data id;
# will record data only after likes, reducing server memory pressure; there is no need to give status to each record first.
Return to jq to get the processing output
Notes
Pay attention to the table creation logic and data redundancy
More For PHP knowledge, please visit PHP中文网!
The above is the detailed content of How to create php like function. For more information, please follow other related articles on the PHP Chinese website!