html
<div class="bphpCode-lang">
<ul>
{loop $pConfig['langs'] $lang}
<li>{$lang}</li>
<li>{$lang}</li>
{/loop}
</ul>
</div>
php
function post_middle(){
global $_G;
$pConfig = $_G['cache']['plugin']['bphp_code'];
$pConfig['block'] = unserialize($pConfig['block']);
}
js
//添加编辑器样式
addStyle = function(){
bphpJQ(".area iframe").contents().find("head").append('<style>.bphp_code_area:before{content:""; border-radius:3px 3px 0 0; background:#F7F7F7; padding:2px 5px; height:5px; color:#999; line-height:12px;font-size:11px; position:absolute; border:1px solid #ddd; border-bottom:none; top:-10px;right:5px;} .bphp_code_area{display:block; position:relative; height:auto; margin:10px 0; text-decoration:none; color:#666; background:#F7F7F7; padding:10px !important; border-radius:3px;border:1px solid #ddd;}</style>');
bphpJQ(".area iframe").contents().find('a').each(function(key,val){
var href = bphpJQ(val).attr('href');
var pat = /^bphpcodelang-/;
if(pat.test(href)){
bphpJQ(val).addClass('bphp_code_area');
bphpJQ(val).addClass('bphp_code_area_'+key);
//语言小标签
var lang = href.split('bphpcodelang-');
bphpJQ(".area iframe").contents().find("head").append('<style>.bphp_code_area_'+key+'::before{content:"'+lang[1]+'";}</style>');
var code = bphpJQ(val).html();
code=code.slice(0,-4); //去掉多出来的<br>
bphpJQ(val).html('<div style="min-height:18px;">'+code+'</div>');
}
});
}
css
#bphp_code{background:url(source/plugin/bphp_code/static/code.png)no-repeat center center; position:relative;text-decoration:none;overflow:auto;}
#bphp_code:hover{background-color:#fff !important;}
.bphpCode-lang{position:absolute;top:0px;left:0px;background:#fff;width:120px;border: 1px solid rgba(0, 0, 0, 0.1);border-radius: 6px;padding: 5px;box-shadow: 0 3px 4px rgb(0 0 0 / 15%);display:none;}
.bphpCode-lang ul li{cursor:pointer;font-size:14px;padding:1px 5px;border:1px solid #fff;}
.bphpCode-lang ul li:hover{background-color: #fff5d4;border: 1px solid #dcac6c;}
java
Date date = new Date();
SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
System.out.println(dateFormat.format(date));
c
int main()
{
char *format_time_string[128] = {0};
long long curr_time = (long long)get_timestamp();
get_format_time_string((char *)format_time_string);
printf("timestamp:%lld, format time:%s",curr_time,format_time_string);
return 0;
}
go
timeUnix:=time.Now().Unix() //单位s,打印结果:1491888244
timeUnixNano:=time.Now().UnixNano() //单位纳秒,打印结果:149188824475278446
python
import time
start_time = time.time()
sum = 0
for i in range(1000000):
sum += i
end_time = time.time()
print("程序执行了%f秒"%(end_time - start_time))
|