-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
43 lines (36 loc) · 833 Bytes
/
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
<?php
error_reporting(E_ALL);
require('amiphp/ami.php');
$urls = array(
'/' => 'index',
'/index/test/*' => 'hello',
);
$db_config =array(
'type' => 'mysql',
'host' => 'localhost',
'user' => 'root',
'password' => '',
'dbname' => 'blog'
);
class index {
function GET($obj) {
$obj->ami->render('views/index.php');
}
}
class hello {
function GET($obj) {
$db=$obj->ami->getDB();
if($db!==false)
{
$user=$db->get_row("SELECT * FROM `users` where userid = 1");
//$db->debug();
}
else
echo 'err';/**/
$data['body']=$obj->ami->loadView('views/body.php',array('name'=>$user->name,'likes'=>$user->password));
//$data['body']=$obj->ami->loadView('views/body.php',array('name'=>'Ami','likes'=>'fun'));
$obj->ami->render('views/index2.php',$data);
}
}
ami::run($urls,$db_config);
?>