-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.php
More file actions
24 lines (21 loc) · 870 Bytes
/
action.php
File metadata and controls
24 lines (21 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
class action {
public function run() {
$GET = filter_input(INPUT_GET, 'url');
$params = explode('/', $GET);
$fileName = array_shift($params);
$filePath = __DIR__ . '/models/' . $fileName . '.php';
$className = $fileName . '_action';
if ($fileName && file_exists($filePath)) {
require __DIR__ . '/models/' . $fileName . '.php';
$app = new $className();
extract($app->handle($params)); //viewに変数をアサイン
require __DIR__ . '/views/' . $fileName . '.php';
} else if(!$fileName || !file_exists($filePath)){
require __DIR__ . '/models/index.php';
$app = new index_action();
extract($app->handle($params)); //viewに変数をアサイン
require __DIR__ . '/views/index.php';
}
}
}