错误404采用纤薄的框架 [英] Error 404 with slim framework

查看:127
本文介绍了错误404采用纤薄的框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习到PHP code和mysql,需要能够运行使用wampserver PHP文件。我已经正确安装WAMP并将其在网上通过Windows 8,但是当我去运行我的PHP文件,我总是给予404错误我已确保我的苗条文件和PHP文件是在正确的目录,我也修改在相应的.htaccess这样,如果没有找到一个网址,因为我测试这我的本地机器上重新路由到正确的文件。下面是我的一些样本code的:

I am learning to code in PHP and mysql and need to be able to run PHP files using a wampserver. I have correctly installed wamp and have it online through Windows 8, however when I go to run my PHP file I am always given Error 404. I have ensured that my Slim file and .php file are in the correct directory and I have also modified the .htaccess accordingly so that it reroutes to the proper file if a URL is not found since I am testing this on my local machine. Here is a some of my sample code:

require 'C:\wamp\www\easysites\codeguy-Slim-b8181de\Slim\Slim.php';
        \Slim\Slim::registerAutoloader();

        $api = new \Slim\Slim();

        $api->run(); 

我已经追查错误$ API - > run()中,并渐渐从一个点的调用堆栈指示错误曾修身的environment.php在123线所在的URL首先处理发生错误。如果我运行通过的Netbeans生成的基本index.php文件,我得到通知我,它正在通常的文字,但是尝试使用它修身出错误这是在根目录下的同一个子目录运行PHP文件。斯利姆是正确的PHP文件加载,但不会让我跑别的从而$ P $看不到,我已经导入了数据库pventing我。

I have traced the error to $api->run() and was getting an error from the call stack at one point that indicated an error had happened in Slim's environment.php at line 123 where the URL is first dealt with. If I run the basic index.php file generated by Netbeans, I get the usual text that alerts me that it is working, however try to run the php file using Slim it errors out which are in the same sub directory under root. Slim is correctly loaded by the php file, but will not allow me to run anything else thus preventing me from seeing the database that I have imported.

有没有人有什么可能会错误的想法?我有一个同事谁已成功运行该文件,但我们不能让它在我的机器上使用的变化同类型上运行。

Does anyone have an idea of what could be going wrong? I have a co-worker who has successfully run the file but we are unable to make it run on my machine using the same types of changes.

.htaccess文件如下:

The .htaccess file is as follows:

RewriteEngine ON

RewriteRule ^API(.*)$ /API/api.php [QSA, L]

我试图运行该文件包含在根目录下名为API中的文件夹中,我试图运行该文件是api.php。

The file I am trying to run is in a folder contained in the root directory named API, and the file I am trying to run is api.php.

推荐答案

在我后面安装的超薄准确(安装它的EasyPHP我的本地Windows计算机上),我得到了错误404的所有的指令。

When I followed all the instructions of the installation of slim exactly (installing it on easyphp on my local windows machine), I got the error 404.

我改变了的.htaccess以下内容,然后把它工作得很好:

I changed the .htaccess to the following, and then it worked fine:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]

这篇关于错误404采用纤薄的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆