Skip to content

Instantly share code, notes, and snippets.

@bulfaitelo
Last active March 25, 2017 12:46
Show Gist options
  • Save bulfaitelo/71ffe19c1108816be86d9106f7afdb5d to your computer and use it in GitHub Desktop.
Save bulfaitelo/71ffe19c1108816be86d9106f7afdb5d to your computer and use it in GitHub Desktop.
03-Routes_and_Tokens
<?php
// FRAMEWORK F3
$f3 = require('../../lib/base.php');
// 03-Routes_and_Tokens,
$f3->route('GET /',
function() {
echo 'Cervejas!!!';
}
);
$f3->route('GET /brewGet/@count',
function($f3){
echo $f3->get('PARAMS.count').' garrafas de cerveja no balde!';
}
);
$f3->route('GET /brew/@count',
function ($f3, $params){
echo $params['count'].' garrafas de cerveja no balde!';
}
);
// Nesse caso aqui ele ira retornar true caso qualquer valor após o /brew/* comente os dois Get /brew para realizar o teste.
$f3->route('GET /brew/*',
function(){
echo "Estamos sem cerveja :/";
}
);
$f3->run();
?>
<!DOCTYPE html>
<html>
<head>
<title>// 02-About</title>
</head>
<body>
<br><br>
<a target='_blank' href="brewGet/99">99 garrafas </a><br>
<a target='_blank' href="brew/120">120 garrafas </a><br>
<a target='_blank' href="brew/">Cabou as cervejas </a><br>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment