K
K
Klen_vladislav2020-12-15 15:15:14
PHP
Klen_vladislav, 2020-12-15 15:15:14

Why does Mamp throw an error when implementing a controller?

There is a controller implementation in php.
When trying to start, MAMP throws an error

Warning: require_once(/Users/klen/PhpstormProjects/myproject.loc/www/../src/MyProject\Controllers\MainController.php): failed to open stream: No such file or directory in / Users/klen/PhpstormProjects/myproject.loc/www/index.php on line 6

Fatal error: require_once(): Failed opening required '/Users/klen/PhpstormProjects/myproject.loc/www/../src/MyProject\Controllers \MainController.php' (include_path='.:/Applications/MAMP/bin/php/php7.3.9/lib/php') in /Users/klen/PhpstormProjects/myproject.loc/www/index.php on line 6

Problem in this code:
spl_autoload_register(function (string $className) {
require_once __DIR__ . '/../src/' . $className . '.php';
});

What could be the problem, tell me please?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question