Skip to content

Instantly share code, notes, and snippets.

@cj
Created April 10, 2011 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cj/912833 to your computer and use it in GitHub Desktop.
Save cj/912833 to your computer and use it in GitHub Desktop.
<?
// Import Framework
require 'klein.php';
respond('GET', '/hello/[:name]?', function ($request, $response) {
$name = $request->param('name', 'World');
echo "Hello $name!";
});
// Run App
dispatch();
@chriso
Copy link

chriso commented Apr 10, 2011

If you have URL rewriting setup properly this should run:

/hello => "Hello World!"

/hello/Chris => "Hello Chris!"

etc.

@brettalton
Copy link

Should this be updated for Klein 2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment