Answer the question
In order to leave comments, you need to log in
Why is Class 'Symfony\Component\HttpFoundation\Request' not found?
I ran into a problem in symfony - the autoloader does not load the class.
autoload.php is like this:
<?php
require_once 'vendor/class-loader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces([
'Symfony\Component\HttpFoundation' => 'vendor/http-foundation/'
]);
$loader->register();
<?php
require_once '../framework/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$request = Request::createFromGlobals();
$input = $request->get('name', 'World');
$response = new Response(sprintf('Hello %s', htmlspecialchars($input, ENT_QUOTES, 'UTF-8')));
$response->send();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question