简体   繁体   English

使用Slim Framework(php)获取HTTP错误500

[英]Getting HTTP error 500 with Slim Framework (php)

I am getting HTTP error 500 when using the Slim framework. 使用Slim框架时出现HTTP错误500。

I have the index.php of Slim Framework in /api/v1/: 我在/ api / v1 /中有Slim Framework的index.php:

<?php

require '../../vendor/autoload.php';

$app = new Slim\App();

$app->get('/auth2', function ($request, $response, $args) {
    $response->write("Welcome to Slim!");
    return $response;
});

$app->run();

In the same folder I have my .htaccess: 在同一文件夹中,我有.htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

But when I go to /api/v1/auth2 the page doesn't load. 但是,当我转到/ api / v1 / auth2时,该页面无法加载。 I only get a HTTP error 500. Have I misconfigured Slim? 我仅收到HTTP错误500。我是否将Slim配置错误?

Put this code at the top of the page you are trying to load. 将此代码放在您尝试加载的页面顶部。

error_reporting(-1);
ini_set('display_errors', 1);

This will print you the errors if your functions are not with @ . 如果您的函数不使用@则会打印出错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM