Php Slim框架错误apache
我的应用程序无法使用Slim Framework和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
$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]
检查您的错误日志,查看导致错误的原因。