miniblog 1.0 汉化

CH上看到老鬼说miniblog,稍微修改了一下,看文字不多,又顺手汉化了一下。
弄得比较匆忙,如果发现有问题请给我留言。

下载:miniblog-1.0.0.zip

php英文字母累加函数

Lane的PHP练习作品。十分感谢我师傅
累加形式如下:
A,B,C,D...X,Y,Z,AA,AB...AZ,BA,BB...
也就是说如果传入参数是ZZ,那么返回的就是AAA。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//code by liuyuanjun.com
function LetterAdd($s){
$Str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$len = strlen($s);
$i = 1;
do{
$a2 = substr($s,$len-$i,1);
$pos = strpos($Str,$a2)+1;
$b2 = $pos>25 ? "A" : $Str[$pos];
$a1 = $len==$i ? ($b2=="A"?"A":"") : substr($s,0,$len-$i);
$a3 = $i==1 ? "" : substr($s,$len-$i+1);
$s = $a1.$b2.$a3;
$i++;
}while($b2=="A" && $len>$i-1);
return $s;
}
for($i=A;$i!="AAA";$i=LetterAdd($i)){
echo $i."\n";
}

文章没有版权,转载请留链接。

PHP柱状图函数

原始HTML大概是从BLUEIDEA得来的吧,记不清了。
PHP我写的,也写了好久了。
现在不用了,在BLOG上留个记录。
CSS部分:

1
2
3
4
5
6
7
8
9
10
11
12
13
<style type="text/css">
<!--
ul.q-graph {border:2px solid #0063be; background:#ffc url(images/graphbg.png) repeat-x scroll 0 0 !important;background:#ffc repeat-x scroll 0 0; position:relative;list-style:none;margin:1.1em 0 3.5em 0; padding:0;}
.q-graph li { position:absolute;text-align:center;bottom:0;padding:0;margin:0;}
li.qtr {border-right:1px dotted #41a3e2; word-wrap:break-word; z-index:2;}
.q-graph ul {list-style:none;}
li.bar {width:34px; font-size:9px; color:#fff; background:#ddd url('images/graphbar.gif') no-repeat -34px 0;}
li.ticks {left:0;width:100%;z-index:1;}
div.ticks {position:relative;margin:0;border-top:1px dotted #41a3e2;}
div.ticks:first-child {border-top:none;} /*only4 Firefx IE 7+*/
div.ticks p {position:absolute;left:101%;top:-2px;margin:0;color:#f00; font-weight:bold;}
-->
</style>

PHP部分:

阅读剩余部分...

饼形图表

在经典上找了个VML图表,可惜只有ASP的输出程序,废半天劲改成PHP的,又加入url传递参数,好乱,眼睛都花了。
VML我不懂,不知哪里有问题,在IE8下,鼠标放上去显示出的百分比不正常。如果有知道的人麻烦告知一下谢谢。

查看效果

==========

用家里的电脑再次确认了一次,也是IE8,没有出现问题,看来是公司电脑的问题,但不明白为什么看原来的VML没有问题。。。

php自定义数组排列

今天在写程序的时候,需要把一个数组按照人工指定的顺序排列。查了下在线手册,使用了uksort()这个函数,但讲的不详细,自己记录一下。

1
2
3
4
5
6
7
8
9
10
11
12
//要排序的数组
$aa['b']="22";
$aa['a']="11";
$aa['c']="33";
function my_sort($a, $b){
$bb = array("a"=>1, "b"=>2, "c"=>3);//数组顺序,键为要排序数组的键,值为顺序
if ($bb[$a] == $bb[$b]) return 0;
return ($bb[$a] < $bb[$b]) ? -1 : 1;
}
print_r($aa);
uksort($aa, "my_sort");
print_r($aa);