mam zainstalowane Symfony2 2.7 w katalogu C: \ xampp \ htdocs \ sym1 \ blog stworzyłem nowy kontroler ręcznie po tym DocumentSymfony2 tworzenia pierwszego kontrolera, ale 404
<?php
// src/AppBundle/Controller/LuckyController.php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
class LuckyController extends Controller
{
/**
* @Route("/lucky/number")
*/
public function numberAction()
{
$number = rand(0, 100);
return new Response(
'<html><body>Lucky number: '.$number.'</body></html>'
);
}
}
ale kiedy iść do
http://localhost/sym1/blog/web/lucky/number
lub
http://localhost/sym1/blog/app_dev.php/lucky/number
po prostu wyświetla
Oops! An Error Occurred
The server returned a "404 Not Found".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
ktoś wie w czym problem?
--update--
jestem po prostu znaleźć skomentuje
#RewriteRule .? %{ENV:BASE}/app.php [L]
a następnie dodać te dwie linie
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app_dev.php [QSA,L]
będzie ok, ale jest tam bar wydajność dołączone na dole strony.
Run cache 'php app/console: jasne --env = prod' za każdym razem chcesz zobaczyć zmiany w produkcji. – malcolm