I recommend you to read my blog
The original paste the address https://zigao.tk/archives/5.html
Foreword
My site and theme is not exactly the same, because I have changed some
links to such websites does not typecho bottom and themes, but I put them up on the page
that specifically how to change, and below me to explain
text
Get rid of the link must be explained in other places otherwise constitute infringement
1. First
We changed that in it, find the theme file footer (usually footer.php) file
to find a similar place
<footer id="footer" role="contentinfo">
<?php $this->options->customFooter(); ?>
<?php if(Utils::isEnabled('showHitokoto','AriaConfig')): ?><p id="hitokoto"></p><?php endif; ?>
<p id="footer-info">© <span><?php echo $this->options->cpr ? $this->options->cpr : date('Y'); ?></span> /<a href="https://zigao.tk/"> Zi_Gao的小站 </a>/<a href="https://zigao.tk/archive.html"> <?php getBuildTime(); ?></a> / 加载时间<?php echo timer_stop();?></p>
</footer><!-- end #footer -->
In this place can modify, add your favorite words
2. Run Time
Suitable positions in the code, add the following in functions.php
// 设置时区
date_default_timezone_set('Shanghai');
function getBuildTime(){
// 在下面按格式输入本站创建的时间
$site_create_time = strtotime('20-01-27 00:00:00');
$time = time() - $site_create_time;
if(is_numeric($time)){
$value = array(
"years" => 0, "days" => 0, "hours" => 0,
"minutes" => 0, "seconds" => 0,
);
if($time >= 31556926){
$value["years"] = floor($time/31556926);
$time = ($time%31556926);
}
if($time >= 86400){
$value["days"] = floor($time/86400);
$time = ($time%86400);
}
if($time >= 3600){
$value["hours"] = floor($time/3600);
$time = ($time%3600);
}
if($time >= 60){
$value["minutes"] = floor($time/60);
$time = ($time%60);
}
$value["seconds"] = floor($time);
echo '<span class="btime">'."站点已运行".$value['days'].'天'.$value['hours'].'小时'.$value['minutes'].'分</span>';
}else{
echo '';
}
}
if (!defined('__TYPECHO_ROOT_DIR__')) {
exit;
}
This code uses <?php getBuildTime(); ?>
call
3. Load Time
Similarly, we add the appropriate location in the code below functions.php file
//显示加载时间
function timer_start() {
global $timestart;
$mtime = explode( ' ', microtime() );
$timestart = $mtime[1] + $mtime[0];
return true;
}
timer_start();
function timer_stop( $display = 0, $precision = 3 ) {
global $timestart, $timeend;
$mtime = explode( ' ', microtime() );
$timeend = $mtime[1] + $mtime[0];
$timetotal = number_format( $timeend - $timestart, $precision );
$r = $timetotal < 1 ? $timetotal * 1000 . "ms" : $timetotal . " s";
if ( $display ) {
echo $r;
}
return $r;
}
Use <?php echo timer_stop();?>
call