Skip to content

Commit

Permalink
Added helper function for redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
larsemil committed Sep 5, 2022
1 parent e1c27fa commit 5bac2a8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions App/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,19 @@ function routeNotFound(){
die("Page not found");

}

/**
* redirect
* Redirects to chosen url
*
* @param mixed $url
* @return void
*/
function redirect($url)
{
if (strpos($url, 'http') !== false) {
header('location: '.$url);
} else {
header('location: ' . $_ENV['BASE_URL'] . $url);
}
}

0 comments on commit 5bac2a8

Please sign in to comment.