未良好形成的数值遇到错误

时间:2015-08-14 18:37:29

标签: php

当脚本运行大约需要15分钟时,此代码曾经工作,脚本现在需要更长时间才能运行,所以我收到此错误

PHP注意:第151行遇到的格式不正确的数值

<div class="container">
    <span>Some Text Here</span>
</div>

.container {
    margin-top: 20px; /* for display in fiddle */
    position: relative;
    border-bottom: 1px dashed #ccc;
}

.container span {
    background-color: #fff;
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translate(-50%); /* need -webkit- and -moz- also
    border: 1px dashed #ccc;
    padding: 5px;
}

1 个答案:

答案 0 :(得分:2)

“非良好形成的数值”。您正在将 STRING 传递给gmdate(),这需要一个整数时间戳。

你可能想要

$time = $time_end - $time_start
$formatted = gmdate('H:i:s', (int)$time);
...
$stmt->bind_param('s', $formatted);

代替。请注意(int),因为您的timestart / end值是浮点值,而date / gmdate则是以秒为单位的时间。 PHP会为你转换,但我喜欢让它明确......