我有一个PHP代码使用date_diff过程来计算两个DateTime对象的不同.有时结果是负面的,但它始终显示为正面.
代码示例:
$time1 = new DateTime('01:00:00');
$time2 = new DateTime('02:00:00');
$resultTime = date_diff($time1, $time2);
echo "RESULT: ".$resultTime->format('%H:%i:%s');
Run Code Online (Sandbox Code Playgroud)
节目:
01:00:00
而正确的是:
-01:00:00
是否有可能显示"真实"结果,消极或积极?
提前致谢!
我试图将图像居中,但它不起作用:(
我使用参数text-align:center;.图像的大小是600x600px,我需要在网站中居中.
我的代码是:
#share-buttons img {
width: 50px;
padding: 5px;
border: 0;
box-shadow: 0;
display: inline;
}
.img-sugar{
width: 600px;
height: 600px;
display: block;
margin: 0 auto
text-align: center;
}Run Code Online (Sandbox Code Playgroud)
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="assets/css-styles/custom-login-style.css" rel="stylesheet">
<div class="container-fluid">
<div class="row">
<div class="col-md-12 text-center">
<img class="img-sugar" src="assets/images/SUGAR.png"/><br><br><br>
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
<form action="shareimage.php" method="post">
<input class="" type="file" accept="image/*" capture="camera"/>
</form>
</div>
</div>
<div class="row" id="share-buttons">
<div class="col-md-12 text-center">
<!-- Facebook -->
<a href="http://www.facebook.com/sharer.php?u=https://simplesharebuttons.com" target="_blank">
<img …Run Code Online (Sandbox Code Playgroud)