-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·47 lines (33 loc) · 1.11 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* Rainy - A Light-Weight PHP Framework For Beginner
*
* @package RainyFramework
* @author Dinh Phong <dinhphong.developer@gmail.com>
*/
define('APPLICATION_TIME_START', microtime(true));
require_once "app/bootstrap.php";
$app = new Rainy\App();
$app->setDefaultController('home');
$app->setDefaultMethod('index');
$options = [
"driver" => "mysql",
"host" => "localhost",
"username" => "root",
"password" => "secret",
"database" => "rainy"
];
$db = new \Rainy\Database\DB($options);
$posts = $db::table('posts')->select('posts.*, users.username as username, users.password as password')->leftJoin('users', 'users.id', '=', 'posts.user_id')->get();
echo "<pre>";
var_dump($posts);
echo "</pre>";
die;
try {
$app->run();
} catch (Exception $e) {
echo 'Caught exception: '. $e->getMessage() . "\n";
}
define('APPLICATION_TIME_END', microtime(true));
define('APPLICATION_RUN_TIME', APPLICATION_TIME_END - APPLICATION_TIME_START);
echo ("<div style='position: absolute; bottom:0; left: 0; padding: 30px; background-color: #eee'>Execute time: ".(APPLICATION_RUN_TIME * 1000)." ms</div>");