Skip to content

Instantly share code, notes, and snippets.

@erikaheidi
Last active December 15, 2015 04:19
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 erikaheidi/5200294 to your computer and use it in GitHub Desktop.
Save erikaheidi/5200294 to your computer and use it in GitHub Desktop.
<?php
$app->get('/lang/{lang}', function($lang) use($app) {
/*
* check if language exists
*/
if (is_dir(__DIR__ . '/locale/' . $lang)) {
/* save user selection in session */
$app['session']->set('current_language', $lang);
}
return $app->redirect($_SERVER['HTTP_REFERER']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment