Skip to content

Instantly share code, notes, and snippets.

@k-holy
Created November 12, 2012 10:11
Show Gist options
  • Save k-holy/4058486 to your computer and use it in GitHub Desktop.
Save k-holy/4058486 to your computer and use it in GitHub Desktop.
Gehirn RS2でSilex使ってみたメモ
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]
{
"require": {
"silex/silex": "1.0.*"
},
"minimum-stability": "dev"
}
<?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