|
1 | 1 | <?php |
2 | | - |
| 2 | +// Default accepting requests from everywhere. You can remove it if you want |
3 | 3 | header('Access-Control-Allow-Origin: *'); |
4 | 4 | header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept'); |
5 | 5 |
|
6 | | -require_once __DIR__.'/core//model/Model.php'; |
7 | | -require_once __DIR__.'/core/controller/Controller.php'; |
8 | | -require_once __DIR__.'/core/helper/Helper.php'; |
9 | | -require_once __DIR__.'/app//model/AppModel.php'; |
| 6 | +define('DS', DIRECTORY_SEPARATOR); |
| 7 | + |
| 8 | +use SimpleORM\core\helper\Helper; |
| 9 | +use SimpleORM\core\model\Model; |
| 10 | +use SimpleORM\core\controller\Controller; |
| 11 | +use SimpleORM\core\model\AppModel; |
10 | 12 |
|
11 | 13 | $uri = $_SERVER['REQUEST_URI']; |
12 | 14 |
|
|
35 | 37 | /* |
36 | 38 | * require files of current Model/Controller |
37 | 39 | */ |
38 | | - $model_file = __DIR__.'/app/model/'.$model.'.php'; |
| 40 | + $model_file = __DIR__ . DS .'app' . DS. ' model ' . DS . $model.'.php'; |
39 | 41 |
|
40 | 42 | if (file_exists($model_file)) { |
41 | 43 | require_once $model_file; |
42 | 44 | } |
43 | 45 |
|
44 | | - $controller_file = __DIR__.'/app/controller/'.$controller.'.php'; |
| 46 | + $controller_file = __DIR__ . DS . 'app' . DS . 'controller' . DS . $controller.'.php'; |
45 | 47 |
|
46 | 48 | if (file_exists($controller_file)) { |
47 | 49 | require_once $controller_file; |
|
52 | 54 | /* |
53 | 55 | * call current class/method |
54 | 56 | */ |
55 | | - //$set = call_user_func_array(array(new $controller(), $method), $the_request); |
56 | 57 | $class = new $controller(); |
57 | 58 | $set = $class->$method($the_request); |
58 | 59 |
|
|
68 | 69 | /* |
69 | 70 | * If method has a view file, include |
70 | 71 | */ |
71 | | - $view_file = __DIR__.'/app/view/'.$model.'/'.$method.'.php'; |
| 72 | + $view_file = __DIR__ . DS . 'app' . DS . 'view' . DS . $model . DS . $method .'.php'; |
72 | 73 |
|
73 | 74 | if (file_exists($view_file)) { |
74 | 75 | include $view_file; |
|
0 commit comments