Slim framework error: called require.. /Slim/Slim/Slim.php';

Asked

Viewed 585 times

0

Error creating when calling Slim.php function

Code:

<?php
    require '../Slim/Slim/Slim.php';
    \Slim\Slim::registerAutoloader();
    $app = new \Slim\Slim();
    $app->response()->header('Content-Type', 'application/json;charset=utf-8');
    $app->get('/', function () {
    echo "SlimProdutos";
});

distribuição das pastas erro na tela

  • It wouldn’t be because the folder names are lowercase?

  • slim or slim ???

  • On your printscreen the folders are slim, but in your require they are Slim. I don’t know if it does, just a suggestion

  • I made the changes and nothing.. the error persists!

  • My version of slim : 3.xx

1 answer

1


From what I understand you’re making use of the Commodore!

Then try to load using the autoload of Poser, below is the example below:

<?php
    require_once __DIR__ . '/vendor/autoload.php';
    $app = new \Slim\Slim();
    $app->response()->header('Content-Type', 'application/json;charset=utf-8');
    $app->get('/', function () {
        echo "SlimProdutos";
    });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.