Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 没有显示人员时间差异的输出_Php - Fatal编程技术网

Php 没有显示人员时间差异的输出

Php 没有显示人员时间差异的输出,php,Php,我试图用人类时间_diff来显示发布内容的时间 我得到的ACF字段如下所示: <?php $commenttime = get_sub_field( 'time', $postid ); ?> 但当我这样做时,不会显示时间差: <?php echo human_time_diff( $commenttime, current_time('timestamp') ) . ' ago'; ?> 我哪里做错了 人类时间差异:确定两个时间戳之间的差异 此函数的使用 hum

我试图用
人类时间_diff
来显示发布内容的时间

我得到的ACF字段如下所示:

<?php $commenttime = get_sub_field( 'time', $postid ); ?>
但当我这样做时,不会显示时间差:

<?php echo human_time_diff( $commenttime, current_time('timestamp') ) . ' ago'; ?>

我哪里做错了

人类时间差异
:确定两个时间戳之间的差异

此函数的使用

human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago';
变量
$commenttime
应在时间戳中

strtotime($commenttime)
也许能帮你
human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago';
strtotime($commenttime)