Skip to content

Instantly share code, notes, and snippets.

@lduboeuf
Last active October 21, 2015 18:48
Show Gist options
  • Save lduboeuf/25c6979dbb814acf5870 to your computer and use it in GitHub Desktop.
Save lduboeuf/25c6979dbb814acf5870 to your computer and use it in GitHub Desktop.
hello world with Silex, use of json_encode
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\HttpFoundation\Response;
$app = new Silex\Application();
$app['debug'] = true;
$app->get('/', function(){
return new Response(json_encode("Hello world"), 200, array( 'Content-Type' => 'application/json' ));
//return json_encode("Hello world");
});
$app->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment