共计475个字符,预计需要花费 1分钟才能阅读完成。
/***
* 在线状态
*/
function get_last_login($user){
$user = '1';
$now = time();
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
$row = $db->fetchRow($db->select('activated')->from('table.users')->where('uid = ?', $user));
if ($row) {
echo Typecho_I18n::dateWord($row['activated'], $now);
} else {
echo '博主一直在这里';
}
}
在前台调用
💻️ <?php $this->author();//用户名 ?> <?php get_last_login(1); ?> 在线
正文完