Php conditions determine the conversion problem. I don't know much about php. I hope you can get help. thank you! I want to add a validity period function to the page of information. if the date exceeds the validity period selected by the publisher, a message indicating that the date has expired is displayed! $ Youxiaoqi is the validity period selected by the user (one week, half month, January, one year, etc.) if the $ you php condition determines the conversion problem.
I don't know much about php. I hope you can get help. thank you!
I want to add a validity period function to the page of information. if the date exceeds the validity period selected by the publisher, a message indicating that the date has expired is displayed!
$ Youxiaoqi is the validity period selected by the user (one week, half month, January, one year, etc)
If $ youxiaoqi = one week, convert it to $ youxiaoqi = 7.
Or change $ youxiaoqi = to a new variable in a week, for example, $ youxiaoqi2 = 7.
And so on! You just need to replace the week and month with the corresponding number.
My code is as follows:
{If (date ('ymmd', $ r [inputtime]) + $ youxiaoqi> date ('ymmd ')}
Tel: 1234567
{Else} prompt: this information has expired!
{/If}
------ Solution --------------------
Since it is the choice, you can assign the corresponding value to the select option.
------ Solution --------------------
If it is missing, time is used to generate the timestamp. The value submitted by select, plus the timestamp, is the expiration time.
------ Solution --------------------
Use timestamps for comparison. obtain the current time and Expiration Time and then compare the time.
In terms of timestamp representation and computation, you can find the knowledge and examples on the Internet.
------ Solution --------------------
On the 4th floor, the solution can be solved by using the select Tag. why bother the landlord?
Your code logic should be fine.
It seems that your format is the template tag, right? is the framework? If yes, the judgment can be completed in the controller, rather than in the presentation layer.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service