Skip to content

Commit 69a2ad9

Browse files
committed
老链接跳转
1 parent 0591c5c commit 69a2ad9

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

blog/article.asp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ var get = new Object();
55
get = GetRequest();
66
var year=2007;
77
id = get['id'];
8+
if(id == 'undefined')
9+
location.href = '/';
810
if(id>118 && id<154){
911
year = 2008;
1012
}else if(id>153 && id<176){

blog/index.html

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,47 @@
1010
<link rel='dns-prefetch' href='//s.w.org'>
1111
<link rel="alternate" type="application/rss+xml" title="网站建设技术集锦 &raquo; Feed" href="http://www.biglee.cn/feed" />
1212
<link rel="alternate" type="application/rss+xml" title="网站建设技术集锦 &raquo; 评论Feed" href="http://www.biglee.cn/comments/feed" />
13-
<script type="text/javascript">
13+
<script type="text/javascript">
14+
var get = new Object();
15+
get = GetRequest();
16+
var year=2007;
17+
id = get['id'];
18+
if(id !== 'undefined'){
19+
if(id>118 && id<154){
20+
year = 2008;
21+
}else if(id>153 && id<176){
22+
year = 2009;
23+
}else if(id>175 && id<182){
24+
year = 2010;
25+
}else if(id>181 && id<198){
26+
year = 2011;
27+
}else if(id>197 && id<231){
28+
year = 2012;
29+
}else if(id>230 && id<253){
30+
year = 2013;
31+
}else if(id>252 && id<304){
32+
year = 2014;
33+
}else if(id==304){
34+
year = 2015;
35+
}else if(id>304){
36+
year = 2016;
37+
}
38+
url = '/blog/'+year+'/'+id+'.html';
39+
location.href=url;
40+
}
41+
42+
function GetRequest() {
43+
var url = location.search; //获取url中"?"符后的字串
44+
var theRequest = new Object();
45+
if (url.indexOf("?") != -1) {
46+
var str = url.substr(1);
47+
strs = str.split("&");
48+
for(var i = 0; i < strs.length; i ++) {
49+
theRequest[strs[i].split("=")[0]]=(strs[i].split("=")[1]);
50+
}
51+
}
52+
return theRequest;
53+
}
1454
window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2\/svg\/","svgExt":".svg","source":{"concatemoji":"http:\/\/www.biglee.cn\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.6"}};
1555
!function(a,b,c){function d(a){var c,d,e,f,g,h=b.createElement("canvas"),i=h.getContext&&h.getContext("2d"),j=String.fromCharCode;if(!i||!i.fillText)return!1;switch(i.textBaseline="top",i.font="600 32px Arial",a){case"flag":return i.fillText(j(55356,56806,55356,56826),0,0),!(h.toDataURL().length<3e3)&&(i.clearRect(0,0,h.width,h.height),i.fillText(j(55356,57331,65039,8205,55356,57096),0,0),c=h.toDataURL(),i.clearRect(0,0,h.width,h.height),i.fillText(j(55356,57331,55356,57096),0,0),d=h.toDataURL(),c!==d);case"diversity":return i.fillText(j(55356,57221),0,0),e=i.getImageData(16,16,1,1).data,f=e[0]+","+e[1]+","+e[2]+","+e[3],i.fillText(j(55356,57221,55356,57343),0,0),e=i.getImageData(16,16,1,1).data,g=e[0]+","+e[1]+","+e[2]+","+e[3],f!==g;case"simple":return i.fillText(j(55357,56835),0,0),0!==i.getImageData(16,16,1,1).data[0];case"unicode8":return i.fillText(j(55356,57135),0,0),0!==i.getImageData(16,16,1,1).data[0];case"unicode9":return i.fillText(j(55358,56631),0,0),0!==i.getImageData(16,16,1,1).data[0]}return!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g,h,i;for(i=Array("simple","flag","unicode8","diversity","unicode9"),c.supports={everything:!0,everythingExceptFlag:!0},h=0;h<i.length;h++)c.supports[i[h]]=d(i[h]),c.supports.everything=c.supports.everything&&c.supports[i[h]],"flag"!==i[h]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[i[h]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
1656
</script>
@@ -122,12 +162,12 @@ <h2 class="entry-title"><a href="http://www.biglee.cn/blog/2016/306.html" rel="b
122162
<div class="entry-content">
123163
<p>   今天在写一个导出数据到csv的功能,为了防止中文乱码,需要将utf8转码,我使用了这样的语句:</p>
124164
<div class="codeText">
125-
<pre class="prettyprint linenums:1">#这里先是把csv文件的内容生成,然后下面转码
165+
<pre class="prettyprint linenums:1">#这里先是把csv文件的内容生成,然后下面转码
126166
$csv=iconv(&#039;utf-8&#039;,&#039;gb2312&#039;,$csv);</pre>
127167
</div>
128168
<p>结果报<span style="color: #ff0000;"><strong><span style="font-family: arial; font-size: 13px; line-height: 20.02px;">Notice: </span><span style="font-family: arial; font-size: 13px; line-height: 20.02px;">iconv():</span><span style="font-family: arial; font-size: 13px; line-height: 20.02px;"> </span><span style="font-family: arial; font-size: 13px; line-height: 20.02px;">Unknown</span><span style="font-family: arial; font-size: 13px; line-height: 20.02px;"> </span><span style="font-family: arial; font-size: 13px; line-height: 20.02px;">error</span><span style="font-family: arial; font-size: 13px; line-height: 20.02px;"> (22)</span></strong></span><span style="color: #333333; font-family: arial; font-size: 13px; line-height: 20.02px;">的错误,想起来$csv里带有换行,所以没办法转换,于是在各个数据项串成csv文件内容前转换,这时报了两个</span><span style="color: #ff0000;"><strong>iconv(): Unknown error (84)</strong></span>的错误,输出内容,发现报错时有一个是处理汉字“密菓”,第二个字不认得,生僻,我突然想到,难道是字符集不支持,于是换成gbk:</p>
129169
<div class="codeText">
130-
<pre class="prettyprint linenums:1">$csv .= iconv(&#039;utf-8&#039;,&#039;gbk&#039;,$val)
170+
<pre class="prettyprint linenums:1">$csv .= iconv(&#039;utf-8&#039;,&#039;gbk&#039;,$val)
131171
</pre>
132172
</div>
133173
<p>再运行,没报错了。</p>

0 commit comments

Comments
 (0)