Created
November 12, 2012 10:11
-
-
Save k-holy/4058486 to your computer and use it in GitHub Desktop.
Gehirn RS2でSilex使ってみたメモ
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
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !\.(ico|gif|jpe?g|png|swf|pdf|css|js)$ | |
RewriteCond %{REQUEST_URI} !index\.php$ | |
RewriteRule .* index.php [NS,L] |
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
{ | |
"require": { | |
"silex/silex": "1.0.*" | |
}, | |
"minimum-stability": "dev" | |
} |
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 | |
require_once realpath(__DIR__ .'/../vendor/autoload.php'); | |
use Silex\Application; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
$app = new Application(); | |
$app->get('/{name}', function(Application $app, Request $request, $name) { | |
$content = <<< CONTENT | |
<html> | |
<body> | |
<h1>こんにちは %s さん</h1> | |
</body> | |
</html> | |
CONTENT; | |
return new Response(sprintf($content, $app->escape($name))); | |
}) | |
->value('name', 'テスト'); | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment