Home Backend Development PHP Tutorial 拍卖网站:显示商品的剩余时间有关问题

拍卖网站:显示商品的剩余时间有关问题

Jun 13, 2016 am 10:09 AM
mvc unix

拍卖网站:显示商品的剩余时间问题
后台添加一个拍卖商品,设置拍卖的结束时间,比如2012年2月22日晚22点整到期,这个结束时间存储在数据库里是转化成10位的unix时间戳格式。

前台显示现在遇到难题了

在拍卖页面显示所有的商品列表,其中有一列就是“剩余时间”。

这个“剩余时间”是数据库里的“结束时间”-“当前服务器系统时间”,然后转换成类似这种输出:
1时11分
2天1时

当小时的数大于24的时候,就显示天数和小时数,否则就显示小时和分钟数

如果只计算一个还好一点,问题是这是个商品列表页面,而我是使用框架MVC模式,在模板里是循环输出拍卖商品的记录。而在模板中,无法对模板变量(结束时间的字段)进行单独的计算处理,像我这种情况应该怎么搞?

------解决方案--------------------
计算与模板无关
何况有些模板也支持运算
------解决方案--------------------
你也可以在M中计算好了再传到V里去。
------解决方案--------------------
用js吧。。。。。。。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does GNU mean? What does GNU mean? Jan 02, 2019 am 11:53 AM

GNU is a Unix-like operating system developed and designed based on Unix and is compatible with Unix. GNU consists of a set of software applications and developer tools and a program that allocates resources and communicates with hardware or the kernel. GNU can be used with other kernels, and is usually used with the Linux kernel. GNU programs can be ported to many other operating systems, including different platforms such as Mac OS X and Microsoft Windows.

What operating system is unix? What operating system is unix? Jan 05, 2021 am 10:26 AM

Unix is ​​a multi-user, multi-process computer operating system that supports multiple processor architectures. According to the classification of operating systems, it is a time-sharing operating system. In addition to being a network operating system, Unix can also be used as a stand-alone operating system. The UNIX system provides a good user interface, which is easy to use, fully functional, clear and flexible, and easy to expand and modify.

PHP MVC Architecture: Building Web Applications for the Future PHP MVC Architecture: Building Web Applications for the Future Mar 03, 2024 am 09:01 AM

Introduction In today's rapidly evolving digital world, it is crucial to build robust, flexible and maintainable WEB applications. The PHPmvc architecture provides an ideal solution to achieve this goal. MVC (Model-View-Controller) is a widely used design pattern that separates various aspects of an application into independent components. The foundation of MVC architecture The core principle of MVC architecture is separation of concerns: Model: encapsulates the data and business logic of the application. View: Responsible for presenting data and handling user interaction. Controller: Coordinates the interaction between models and views, manages user requests and business logic. PHPMVC Architecture The phpMVC architecture follows the traditional MVC pattern, but also introduces language-specific features. The following is PHPMVC

KDE Plasma 6.1 brings many enhancements to the popular Linux desktop KDE Plasma 6.1 brings many enhancements to the popular Linux desktop Jun 23, 2024 am 07:54 AM

After several pre-releases, the KDE Plasma development team unveiled version 6.0 of its desktop environment for Linux and BSD systems on 28 February, using the Qt6 framework for the first time. KDE Plasma 6.1 now comes with a number of new features t

Why are linux and unix similar? Why are linux and unix similar? Mar 13, 2023 am 10:20 AM

The original intention of Linux was to replace UNIX and optimize its functions and user experience. Therefore, Linux imitated UNIX (but did not plagiarize the source code of UNIX), making Linux very similar to UNIX in appearance and interaction. Therefore, it can be said that "UNIX is the father of Linux". It is precisely because Linux and UNIX are inextricably linked that people call Linux a "UNIX-like system."

Unix Philosophy Programming Principles Unix Philosophy Programming Principles Feb 20, 2024 am 10:54 AM

1Unix philosophy The Unix philosophy emphasizes practicality, comes from rich experience, and is not restricted by traditional methodologies or standards. This knowledge is more latent and semi-instinctive. The knowledge that Unix programmers accumulate through development experience can benefit other programmers. (1) Each program should focus on completing one task and start over when encountering a new task to avoid adding new functions to the original program, resulting in increased complexity. (2) Assuming that the output of a program will become the input of another program, even if the next program is not clear, make sure that the output does not contain irrelevant information. (3) Put the designed and written software into trial use as soon as possible, and discard low-quality code decisively and rewrite it. (4) Use tools prior to inefficient auxiliary means to reduce the burden of programming tasks and strive for excellence.

What are the differences between unix and windows What are the differences between unix and windows Sep 07, 2023 pm 01:27 PM

The differences are: 1. UNIX is open source, while Win is proprietary software, and its source code is not open to the public; 2. UNIX is designed for multi-user, multi-task environments, while Win is suitable for individuals; 3. Win is more powerful than UNIX Easy to get started; 4. UNIX performs better than Win in terms of performance and stability; 5. Win has wider application and software compatibility than UNIX; 6. UNIX licenses are usually more expensive than Win; 7. UNIX has better security Performance is better than Win in terms of performance; 8. UNIX installation is simpler than Win.

Imitate the myfind command in the unix operating system to implement a myfind Imitate the myfind command in the unix operating system to implement a myfind Mar 07, 2024 pm 12:20 PM

Imitate the find command in the Unix operating system and implement a myfind command. The myfind command starts from the specified directory and searches for the specified file recursively. The command format is as follows: myfindPATH-option parameter [-print][-exec command {};]PATH: starting directory to search. -option parameter: Used to control the search method, the details are as follows (only the ones I commonly use are given below): -name "file": Specify the file name to be searched for. The Linux command locates the file. It can be escaped?*, etc. -prune directory: Do not search this directory when emphasizing search. -mtime+n or -n: Search linux command location files by time, +n: means

See all articles