Skip to content

Commit

Permalink
Merge pull request #10 from tanhongit/v2
Browse files Browse the repository at this point in the history
fix get controller and action for homepage
  • Loading branch information
tanhongit authored Jul 18, 2022
2 parents 3a55719 + 2a1de6c commit 71fb3fe
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,18 @@
// }
// }
// counting_ip();
if (isset($_GET['controller'])) $controller = $_GET['controller'];
else $controller = 'home';
if (isset($_GET['action'])) $action = $_GET['action'];
else $action = 'index';
if (isset($_GET['controller']) && '' != $_GET['controller']) {
$controller = $_GET['controller'];
} else {
$controller = 'home';
}

if (isset($_GET['action']) && '' != $_GET['action']) {
$action = $_GET['action'];
} else {
$action = 'index';
}

$file = 'content/controllers/' . $controller . '/' . $action . '.php';
if (file_exists($file)) {
require($file);
Expand Down

0 comments on commit 71fb3fe

Please sign in to comment.