Created
December 21, 2011 21:36
-
-
Save michalpipa/1507820 to your computer and use it in GitHub Desktop.
Symfony2 router for PHP 5.4 build-in web server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_SERVER['SCRIPT_FILENAME'])) { | |
return false; | |
} else { | |
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'] | |
. DIRECTORY_SEPARATOR | |
. 'app.php' | |
; | |
require 'app.php'; | |
} |
Thank you Jérôme. I've actually done this in my pull request: symfony/symfony#3465
Sample router is updated now
Nice ! This would be a really nice addition to Symfony indeed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To work properly and make Symfony being able to proper URLs, you need to set
$_SERVER['SCRIPT_FILENAME']
toapp.php
(or better :app_dev.php
). Otherwise you might have double slashes in generated URLs.