-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
48 lines (40 loc) · 1.17 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
48
<?php
/**
* index.php
*
* App entry point
*
* @author Prahlad Yeri <[email protected]>
* @license MIT
*/
//@todo: add docstrings for functions
require('core/router.php');
require('core/util.php');
session_start();
//$base_url = "http://localhost:8000/src/"; //for easy access to static paths
//$index_file = 'index.php'; //set blank if you rewrite index.php in .htaccess
//@todo: initialize constants and vars
const VERSION = "0.1";
//@todo: initialize database
$dbh = new PDO("sqlite:minimal-mvc.db");
function index() {
//echo uri_segment(1) ."<br>";
//echo "segments::" . print_r(uri_segments(), true) . "<br>";
echo "<h1>It Works!</h1>";
}
function arcane(){
echo "<p>Pattern Match!</p>";
echo "<p>The uri segments are :".print_r(uri_segments(),true)."</p>";
}
function testmvc() {
$vars = ["foo"=>'bar', 'title'=>'Testing'];
load_template('templates/dummy.php', $vars);
}
function testform(){
echo "<form method='post'><input name='sample_field' value=''><button type='submit'>Submit</button></form>";
}
dispatch(function(){
//check install and any other common initialization
//global $dbh;
error_log("pre-dispatch:");
});