- Php_user_info
- --------------------
- Uid username password
- User id, user name, and password
- --------------------
2. the table that saves the information sent to the user. For example:
- Php_user_message
- -------------------------------------------
- Id uid mid ifShow ifRead
- Whether the message id (and) of the auto-increment user shows whether the user has read the message
3. table for saving messages. For example:
- Php_message
- ----------------
- Mid title content
- Message id header content
When you want to send a message to a User: 1. retrieve all UIDs from php_user_info (assuming they are saved in the array $ array_uid), and then set the id of the message you want to send to the user to php_message to mid. Then, the insert operation is executed cyclically (insert uid and mid together into php_user_message. the default values of id, ifShow, and IfRead are null, 0, and 0, respectively ). Notify users: the page calls ajax at regular intervals to check whether there is any data with ifShow 0 in the php_user_message of the user with the uid. if the value is 0, the page prompts the user to receive the message, and change to 1. Enter Message Center: Check whether ifRead is 1. if not, it is displayed as Unread. when you click a message, change ifRead to 1. The above introduces the design principle of implementing the message sending in the background administrator group, hoping to help you with some guidance and help in writing similar php programs. |