久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Fat Free 框架中 mod_rewrite 的簡(jiǎn)單問題

Simple problem with mod_rewrite in the Fat Free Framework(Fat Free 框架中 mod_rewrite 的簡(jiǎn)單問題)
本文介紹了Fat Free 框架中 mod_rewrite 的簡(jiǎn)單問題的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在嘗試為 PHP 設(shè)置和學(xué)習(xí) Fat Free 框架.http://fatfree.sourceforge.net/

I am trying to setup and learn the Fat Free Framework for PHP. http://fatfree.sourceforge.net/

設(shè)置相當(dāng)簡(jiǎn)單,我使用 MAMP 在我的機(jī)器上運(yùn)行它.

It's is fairly simple to setup and I am running it on my machine using MAMP.

我能夠讓 'hello world' 示例僅在 fin 上運(yùn)行:

I was able to get the 'hello world' example running just fin:

require_once 'path/to/F3.php';
F3::route('GET /','home');
    function home() {
        echo 'Hello, world!';
    }
F3::run();

但是當(dāng)我嘗試添加有兩條路線的第二部分時(shí):

But when I try to add in the second part, which has two routes:

require_once 'F3/F3.php';

require_once 'F3/F3.php';

F3::route('GET /','home');
function home() {
    echo 'Hello, world!';
}

F3::route('GET /about','about');
function about()
{
    echo 'About Us.';
}

F3::run();

如果我嘗試第二個(gè) URL:/about

I get a 404 error if I try the second URL: /about

不確定為什么 mod_rewrite 命令中的一個(gè)會(huì)起作用,而另一個(gè)不起作用.

Not sure why one of the mod_rewrite commands would be working and not the other.

下面是我的 .htaccess 文件:

# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]

# Disable ETags
Header Unset ETag
FileETag none

# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A604800
</IfModule>

推薦答案

所以我的朋友實(shí)際上幫我解決了這個(gè)問題.我遇到了完全相同的問題,但基本上我也在使用 MAMP,并且在 MAMP 的 htdocs 中的 fatfree 目錄中保存了我所有的 Fat Free 文件.

So my friend actually helped me out with this issue. I ran into the exact same problem, but basically I'm using MAMP also and have all my Fat Free files within a fatfree dir within htdocs of MAMP.

解決方案是您需要修改 RewriteBase 以指向 /[dirname]/ 而不僅僅是 / 然后更改 RewriteRule/[dirname]/index.php.

The solution is you need to mod the RewriteBase to point to /[dirname]/ instead of just / and then change RewriteRule to /[dirname]/index.php.

我的 .htaccess 如下所示:

My .htaccess looks like this:

RewriteEngine On
RewriteBase /fatfree/
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /fatfree/index.php [L,QSA]

設(shè)置后,您可以完全按照 Fat Free 文檔中的示例進(jìn)行操作,它會(huì)像魅力一樣發(fā)揮作用.這讓我難住了一段時(shí)間,這就是它所需要的.此外,如果您使用 MAMP,請(qǐng)編輯 /Applications/MAMP/conf/apache 中的 httpd.conf 文件,并確保更改以下內(nèi)容:

After that's set, you can follow the example in the Fat Free doc exactly and it'll work like a charm. This stumped me for a while and this was all it needed. Also, if you're using MAMP, edit the httpd.conf file in /Applications/MAMP/conf/apache and be sure to alter the following:

<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>

<Directory />
    Options Indexes FollowSymLinks
    AllowOverride All
</Directory>

基本上把None改成All.

這篇關(guān)于Fat Free 框架中 mod_rewrite 的簡(jiǎn)單問題的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Action View Helper in Zend - Work around?(Zend 中的動(dòng)作視圖助手 - 解決方法?)
Is this a good way to match URI to class/method in PHP for MVC(這是將 URI 與 PHP 中用于 MVC 的類/方法匹配的好方法嗎)
Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?(我在哪里保存 Zend Framework 中的部分(視圖),以便我的應(yīng)用程序中的所有視圖都可以訪問?) - IT屋-程序員軟件開發(fā)技術(shù)
Having a single entry point to a website. Bad? Good? Non-issue?(有一個(gè)網(wǎng)站的單一入口點(diǎn).壞的?好的?沒問題?)
Is MVC + Service Layer common in zend or PHP?(MVC + 服務(wù)層在 Zend 或 PHP 中常見嗎?)
Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)
主站蜘蛛池模板: 婷婷成人在线 | 一区二区av | 狠狠干在线 | 成人av色 | 一区二区三区视频在线 | 国产 欧美 日韩 一区 | 久久成人国产精品 | 天堂av影院 | 激情一区二区三区 | 免费国产一区二区 | 亚洲综合色婷婷 | 两性午夜视频 | 亚洲精品一 | 国产精品123区 | 午夜免费网 | 精品一二区| 国产视频第一页 | 国产精品自拍视频 | 又黄又色 | h视频免费在线观看 | 亚洲精品麻豆 | 中文字幕免费观看 | 欧美日韩高清在线一区 | 日韩在线国产 | 国产精品免费看 | 国产精品成人久久久久 | 熟女毛片 | 999免费观看视频 | 久久久精选 | 一本大道久久a久久精二百 欧洲一区二区三区 | 99av成人精品国语自产拍 | 日韩网站在线观看 | 午夜电影合集 | 午夜国产精品视频 | 91麻豆精品国产91久久久更新资源速度超快 | 日韩在线免费 | 亚洲国产成人精 | 成人高清视频在线观看 | 欧美激情视频一区二区三区在线播放 | 精品欧美一区二区在线观看视频 | av一区二区三区四区 |