开发者

Can't access time helper from view

开发者 https://www.devze.com 2023-04-10 13:12 出处:网络
<?php echo $time->timeAgoInWords($row[\'Forum\'][\'modified\']); ?> The modified column from which I am receiving the data is formatted as MySQL datetime.
<?php echo $time->timeAgoInWords($row['Forum']['modified']); ?>

The modified column from which I am receiving the data is formatted as MySQL datetime.

I am trying to use the above code to get a time value shown formatted with timeAgoInWords(), but I keep getting this error.

Undefined property: time [APP\views\forums\view.ctp, line 6开发者_C百科0]

I don't understand why I am getting this error.


In Your controller or app_controller, Put below code,

var $helpers = array('Form', 'Html', 'Javascript', 'Time');
0

精彩评论

暂无评论...
验证码 换一张
取 消