简体   繁体   中英

YII extensions : how to install time extension?

i am a beginner in YII framework, does anyone know how to install this extension?

http://www.yiiframework.com/extension/time/

how to install this extension is not explained in its documentation. i want to convert a timestamp to format "time ago" "1 hour ago" "2 hours ago".

Its a normal class I think.

Copy file in components o extensions. In your config/main.php

'import'=>array(
    'application.models.*',
    'application.components.*',//if Time.php in components
    'ext.*', // if Time.php in extensions

),

Use

$variable = Time::timeAgoInWords($time)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM