Fixed mixed indents

This commit is contained in:
Chris 2018-03-20 16:04:48 +01:00
parent bbffaef1ff
commit d0193d3f74

View File

@ -19,27 +19,27 @@ include('Route.php');
// Add base route (startpage)
Route::add('/',function(){
echo 'Welcome :-)';
echo 'Welcome :-)';
});
// Another base route example
Route::add('/index.php',function(){
echo 'You are not realy on index.php ;-)';
echo 'You are not realy on index.php ;-)';
});
// Simple test route that simulates static html file
Route::add('/test.html',function(){
echo 'Hello from test.html';
echo 'Hello from test.html';
});
// Post route example
Route::add('/contact-form',function(){
echo '<form method="post"><input type="text" name="test" /><input type="submit" value="send" /></form>';
echo '<form method="post"><input type="text" name="test" /><input type="submit" value="send" /></form>';
},'get');
// Post route example
Route::add('/contact-form',function(){
echo 'Hey! The form has been sent:<br/>';
echo 'Hey! The form has been sent:<br/>';
print_r($_POST);
},'post');
@ -48,39 +48,39 @@ Route::add('/contact-form',function(){
// Also users could inject mysql-code or other untrusted data if you use (.*)
// You should better use a saver expression like /user/([0-9]*)/edit or /user/([A-Za-z]*)/edit
Route::add('/user/(.*)/edit',function($id){
echo 'Edit user with id '.$id.'<br/>';
echo 'Edit user with id '.$id.'<br/>';
});
// Accept only numbers as parameter. Other characters will result in a 404 error
Route::add('/foo/([0-9]*)/bar',function($var1){
echo $var1.' is a great number!';
echo $var1.' is a great number!';
});
// Crazy route with parameters
Route::add('/(.*)/(.*)/(.*)/(.*)',function($var1,$var2,$var3,$var4){
echo 'This is the first match: '.$var1.' / '.$var2.' / '.$var3.' / '.$var4.'<br/>';
echo 'This is the first match: '.$var1.' / '.$var2.' / '.$var3.' / '.$var4.'<br/>';
});
// Long route example
// This route gets never triggered because the route before matches too
Route::add('/foo/bar/foo/bar',function(){
echo 'This is the second match <br/>';
echo 'This is the second match <br/>';
});
// 405 test
Route::add('/this-route-is-defined',function(){
echo 'You need to patch this route to see this content';
echo 'You need to patch this route to see this content';
},'patch');
// Add a 404 not found route
Route::pathNotFound(function($path){
echo 'Error 404 :-(<br/>';
echo 'Error 404 :-(<br/>';
echo 'The requested path "'.$path.'" was not found!';
});
// Add a 405 method not allowed route
Route::methodNotAllowed(function($path, $method){
echo 'Error 405 :-(<br/>';
echo 'Error 405 :-(<br/>';
echo 'The requested path "'.$path.'" exists. But the request method "'.$method.'" is not allowed on this path!';
});