gpt4 book ai didi

php - 显示意外的“。但我不知道为什么

转载 作者:行者123 更新时间:2023-11-29 15:34:10 25 4
gpt4 key购买 nike

Parse error: syntax error, unexpected '‬' (T_STRING).

当我使用该行作为以前的行时。

$past=$row['date'];
$present= date("Y-m-d H:i:s");
$second= strtotime($present) - strtotime($past);
if($second<=60){echo "Just Now";}
elseif($second<=3600){echo round($second/60) ."min";}
elseif($second<=86400){echo round($second/3600) . "hour";}
elseif($second<=604800){echo round($second/86400) . "day";}
elseif($second<=2592000‬){echo round($second/604800) . "week";} //in this line
elseif($second<=31536000‬‬){echo round($second/2592000) . "month";}
else{echo $row['date'];}

最佳答案

您的代码中存在一些不可见的 unicode 字符。您可以尝试使用下面的方法:

$past = $row['date'];
$present = date("Y-m-d H:i:s");
$second = strtotime($present) - strtotime($past);
if ($second <= 60) {
echo "Just Now";
} elseif ($second <= 3600) {
echo round($second / 60) . "min";
} elseif ($second <= 86400) {
echo round($second / 3600) . "hour";
} elseif ($second <= 604800) {
echo round($second / 86400) . "day";
} elseif ($second <= 2592000) {
echo round($second / 604800) . "week";
} elseif ($second <= 31536000) {
echo round($second / 2592000) . "month";
} else {
echo $row['date'];
}

一个位于 2592000 之后,另外两个位于 31536000 之后,就在结束括号之前。

关于php - 显示意外的“。但我不知道为什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58425091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com