Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Slim框架错误apache_Php_Linux_Apache_.htaccess_Slim - Fatal编程技术网

Php Slim框架错误apache

Php Slim框架错误apache,php,linux,apache,.htaccess,slim,Php,Linux,Apache,.htaccess,Slim,我的应用程序无法使用Slim Framework和apache 线路苗条,不工作 $app->group("/teste", function() { $this->get("/", function(Request $request, Response $response, $args = []) { return $response->write("deu"); }); $this->get("/:nome", functio

我的应用程序无法使用Slim Framework和apache

线路苗条,不工作

$app->group("/teste", function() {
    $this->get("/", function(Request $request, Response $response, $args = []) {
        return $response->write("deu");
    });

    $this->get("/:nome", function(Request $request, Response $response, $args = []) {
        return $response->write("deu ".$args['nome']);
    });
});
.htaccess正在使用中和index.php(Slim)位于同一位置:public\u html/Slim/biblioteca/

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
尝试访问路由/测试时返回错误500/

可能需要配置或创建httpd.conf并启用.htaccess?此外,还允许超越所有限制。

在/etc中找不到此文件/

你能帮我吗

Printscreen项目列表文件


在.htaccess文件中添加以下代码

RewriteEngine On

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with,content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

定义根目录,如下例所示:

\Slim\Slim::registerAutoloader();

$app = new \Slim\Slim();

$app->post('/example', 'examplefunction');

我希望它能工作

在.htaccess文件中使用下面的代码,它就能工作

<ifModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ index.php/$1 [NC,QSA,L]

</ifModule>

重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写规则^(.*)$index.php/$1[NC,QSA,L]

检查您的错误日志,查看导致错误的原因。