PHP实现URL重写

WordPress的文章大部分地址都是url重写的,下面介绍下利用.htaccess实现url重写。

首先看一个地址:http://yilee.info/notepad1/note/yilee 这个地址的yilee其实是虚拟的,note也并不是一个文件夹,实现起来很简单,在目录下加个.htaccess文件,内容是:

<Files note>
    ForceType application/x-httpd-php
</Files>

ok,第一步完成,很容易理解,Apache看到note的url都会当做PHP去处理,在note里我们就要处理这个url了,上PHP代码:

<?php
    $fields = explode(‘/’, $_SERVER['REQUEST_URI']);
?>

$fields是一个数组,其中$fields[3]就是本文中yilee,其它可以自己尝试,重写完毕,剩下的就靠自己发挥了。

在Ubuntu中解决键盘替换

某天上机课一杯子水洒在了键盘上,从此Esc键就变得异常迟钝了(传说thinkpad键盘是防水的,不知是不是从IBM开始就是骗小孩的,还是被lenovo毁了。。。),其实这键也没什么用,直到某天开始接触vim,Esc突然变得这么重要。。。
下面是网上找来的ubuntu下键盘替换的教程,其实就是改了一下键盘映射。
首先输入xev,按下键盘后可以看到对应的keycode,如Esc 9,Fn 151,win 133。
输入xmodmap -pk
找到Esc对应名称,为Escape,
接着打开或新建 gedit ~/.Xmodmap
加入 keycode 133 = Escape
意思很明显就是:定义keycode 133为 Escape按键
然后注销再登录就可以了,以后win键就可以代替Esc键了,对着几十个例子练了一下vi,真够难用的,不过感觉切换模式win键比Esc好用很多嘛,,至少距离近,按着方便。。
Continue reading

Just One Last Dance

We meet in the night in the spanish cafe
I look in your eyes just don’t know what to say
It feels like I’m drowning in salty water 
Afew hours left’til the sun’s gonna rise 
Tomorrow will come an it’s time to realize
Our love has finished forever
How I wish to come with you(wish to come with you)
how I wish we made it through
Just one last dance
Before we say goodbye
When we sway and turn round and round and round 
It’s like the first time 
Just one more chance 
Hold me tight and keep me warm 
Cause the night is getting cold 
And Idon’t know where I belong 
Just one last dance

Continue reading

无觅相关文章插件,快速提升流量