PHP Fatal error: Class 'Slim' not found

送分小仙女□ 提交于 2019-11-28 02:16:19

The Slim class' full name (including namespace) is \Slim\Slim so you'll need to use that, eg

$app = \Slim\Slim::getInstance();

Alternatively, you can import the Slim symbol using the use statement at the top of your item.php script.

use Slim\Slim;

You can use this code for Slim Framework3:

<?php

require "vendor/autoload.php";
use \Slim\App;

$app = new App();

$app->get("/",function(){

    echo "Hello World";

});

$app->get("/test",function(){

    echo "Hello World";

});

$app->run();

?>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!