dqsp60748 2018-03-16 10:48
浏览 60
已采纳

如何声明函数的日期特定值

from this use example:

echo time_elapsed_string('2013-05-01 00:22:35', true);

from this Converting timestamp to time ago in PHP e.g 1 day ago, 2 days ago...

it must write exactly the date '2013-05-01 00:22:35'

now, i want to take date from this data in red box: enter image description here which i succeed if i write it like this:

<h4>di posisi sekarang:<br> <?php echo $row["tanggal"];  ?></h4><br>

but when i used it like this:

echo time_elapsed_string('<?php echo $row["tanggal"];  ?>', true);

it doesn't work, how do i get the data right?

  • 写回答

1条回答 默认 最新

  • doutan5798 2018-03-16 10:56
    关注

    You are trying to write PHP inside a PHP string. Just remove PHP tags and echo:

    echo time_elapsed_string($row["tanggal"], true);
    

    In your context:

    <h4>di posisi sekarang:<br> 
        <?php echo time_elapsed_string($row["tanggal"], true);  ?>
    </h4><br>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法