在PHP中服务器上的时差不起作用 [英] time difference not working on server in php

查看:64
本文介绍了在PHP中服务器上的时差不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友



i希望通过我的代码在本地服务器上正常运行来获得时差,但是当我使用它来服务器时它会给出错误的结果告诉我是什么问题



 <?php  

$ first = $ status [' in_time']。 。$ status [' am_time'];
$ second = $ status [' out_time']。 。$ status [' pm_time'];
$ d1 = strtotime($ first);
$ d2 = strtotime($ second);
$ diff = $ d2- $ d1;
// echo $ diff;
echo date( H:i,$ diff);
?>

解决方案

first =

status [' in_time']。


status [' am_time'];


Dear Friends

i want to get the time difference with the help of my code working fine on local server but it gives wrong result when i use it to server please tell me what is the problem

<?php

$first=$status['in_time']."".$status['am_time'];
$second=$status['out_time']."".$status['pm_time'];
$d1=  strtotime($first);
$d2=  strtotime($second);
$diff=$d2-$d1;
//echo $diff;
echo date("H:i",$diff);
?>

解决方案

first=


status['in_time']."".


status['am_time'];


这篇关于在PHP中服务器上的时差不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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