简体   繁体   中英

Is it possible to make an “add to favorites” feature using cookies?

I want to make a function using php, where guests can add posts to their favorites (so no signup is needed). I tried using MySQL but I got to a dead end because I couldn't find a way to determine a unique device. Some people have told me that I can do the same thing using cookies, can anyone tell me how?

  1. User clicks "favorite this post" button/link
  2. Using PHP you set the cookie containing favorited post id, along with the already favorites id's that might have been there.
  3. On the "your favorite posts" page you retrieve the cookie and query the database for the id's.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM