no comments yet
04 Apr 2018

语法高亮工具highlight.js

用highlight.js来实现代码高亮显示,只需要三行代码就可以了,非常方便:

<link href="https://highlightjs.org/static/demo/styles/default.css" rel="stylesheet">
<script src="https://highlightjs.org/static/highlight.pack.js"></script>
<script >hljs.initHighlightingOnLoad();</script>

更多配色可以直接在官网中参考。https://highlightjs.org/static/demo/

no comments yet
04 Jan 2018

php中计算分页总页数

假设数据共有1005条,计划每10条为一页:
总页数= ceil(总数/每页数量)

$pages = ceil(1005/10);
no comments yet
20 Dec 2017

python获取下载资源的真实地址

获取下载资源的直链地址:

import httplib
conn = httplib.HTTPConnection("www.sample.com")
conn.request("HEAD", "/download/down.jsp?DownID=8")
res = conn.getresponse()
print res.getheaders()