问题描述:

For example: x user booking ticket on monday and ticket status changing as book. After three days, ticket status will change as free(empty) automatically. How can I do this?

网友答案:

Try something like this (using strtotime):

if ($ticket_timestamp < strtotime("-3 days")) {
  // ticket is expired
}
网友答案:

You will usually want to check this by date. If you don't care about the actual date but just need to compare, you can use the time() function. The day is time()/60/60/24 .

You can store the timestamp of the order in the database and then compare it with the current time.

相关阅读:
Top