如何在php网站中实现秒表 [英] how can implement a stop watch in a php site

查看:277
本文介绍了如何在php网站中实现秒表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请尽快帮助我 ,因为我是该领域的新手
如何在php站点中实现秒表以显示技术人员解决问题所花费的总时间

please help me as soon as possible because i am new in this field
how can implement a stop watch in a php site for displaying the total time consume by a technician to resolve the problem

推荐答案

您可以使用此javascript秒表.

JavaScript秒表 [
You can use this javascript stopwatch.

JavaScript Stopwatch[^]

You just need to pass the value from clientside to serverside once you are stopping the watch so that it can be stored on server(if you have to save it in DB)


:- (based on your comments)

Here is a little algorithm:

1. When you have to start the watch get the server time and keep it in session.
2. use javascript to show this time on page.
3. when user goes to another page read the start time again from session and display time accordingly.
4. when user hit stop, take the server time again, get the timespan using session value and store in DB.

P.S. dont know PHP else could have given you the code too.


注意:发布另一种解决方案只是避免在原始解决方案中造成混乱:

所以我做了一些搜索,看来此页面显示了如何使用javascript:在页面上显示服务器时间:

http://www.coursesweb.net/javascript/javascript-code-php [ ^ ]

现在,您可以使用此代码并根据我的算法对其进行修改,或者这也是第二个.

0.使用上面的代码显示客户端上的服务器时间.
1.计时器启动时,将此时间保存在服务器上的DB中.
2.停止时,将此时间发送到服务器.
3.现在,根据旧值和新值计算时间跨度并保存.
Note: Posting another solution just avoid clutter in original one:

So i did some search and it seems this page shows how to show server time on page using javascript:

http://www.coursesweb.net/javascript/javascript-code-php[^]

Now you can use this code and modify it with as for my algo or here is second also.

0. use this above code to show server time on client.
1. when timer starts, save this time in DB, on server.
2. when it stops, send this time to server.
3. now calculate the timespan based on the old value and new value and save it.


这篇关于如何在php网站中实现秒表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆