PHP-For-Go-Web《Go Web 編程》PHP網(wǎng)站版
PHP-For-Go-Web 是用 php+bootstrap3 來解析《Go Web 編程》的 md 文件。構(gòu)建本地或者遠(yuǎn)程網(wǎng)站。媽媽再也不用擔(dān)心我的網(wǎng)速了。
-
從https://github.com/astaxie/build-web-application-with-golang/tree/master/zh 獲取md文件
-
從https://github.com/erusev/parsedown 獲取 Markdown 格式數(shù)據(jù)的 PHP 解析類庫
-
使用 PHP 解析得到 html 數(shù)據(jù)
-
使用 Bootstrap 顯示最終的html頁面
我不生產(chǎn)代碼,我是代碼的搬運(yùn)工! 展示站點(diǎn):http://go.webiji.com
安裝配置
[ Apache ]
httpd.conf配置文件中加載了mod_rewrite.so模塊
AllowOverride None 將None改為 All
把下面的內(nèi)容保存為.htaccess文件放到應(yīng)用入口文件的同級目錄下
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?file=$1 [QSA,PT,L]
</IfModule>
本項(xiàng)目在wampserver下開發(fā)并且通過測試。建議使用wampserver環(huán)境。
[ IIS ]
如果你的服務(wù)器環(huán)境支持ISAPI_Rewrite的話,可以配置httpd.ini文件,添加下面的內(nèi)容:
RewriteRule (.*)$ /index\.php\?file=$1 [I]
[ Nginx ]
通過在Nginx.conf中配置轉(zhuǎn)發(fā)規(guī)則實(shí)現(xiàn):
location / { // …..省略部分代碼
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?file=$1 last;
break;
}
}
如果你的項(xiàng)目安裝在二級目錄,Nginx的偽靜態(tài)方法設(shè)置如下,其中g(shù)oweb是所在的目錄名稱。
location /goweb/ {
if (!-e $request_filename){
rewrite ^/goweb/(.*)$ /goweb/index.php?file=$1 last;
}
}評論
圖片
表情
