Spaces:
Sleeping
Sleeping
Commit
·
9a18c8c
1
Parent(s):
9ec902f
Use default controller
Browse files- mvc/app/controllers/Welcome.php +7 -0
- mvc/app/libs/Core.php +9 -2
mvc/app/controllers/Welcome.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Welcome{
|
3 |
+
public function __construct(){
|
4 |
+
echo('Welcome to app');
|
5 |
+
}
|
6 |
+
}
|
7 |
+
|
mvc/app/libs/Core.php
CHANGED
@@ -15,8 +15,15 @@
|
|
15 |
protected $defaultParams = [];
|
16 |
|
17 |
public function __construct(){
|
18 |
-
// $
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
public function getURL(){
|
|
|
15 |
protected $defaultParams = [];
|
16 |
|
17 |
public function __construct(){
|
18 |
+
// print_r($this->getURL());
|
19 |
+
$url = $this->getURL();
|
20 |
+
|
21 |
+
if (file_exists('../app/controllers/' . ucwords($url[0]) . '.php')) {
|
22 |
+
$this->defaultController = ucwords($url[0]);
|
23 |
+
unset($url[0]);
|
24 |
+
}
|
25 |
+
require_once('../app/controllers/' . $this->defaultController . '.php');
|
26 |
+
$this->defaultController = new $this->defaultController;
|
27 |
}
|
28 |
|
29 |
public function getURL(){
|