File tree 2 files changed +40
-1
lines changed
2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ public function index()
19
19
Init::view ('index ' );
20
20
}
21
21
22
+ public function payMe ()
23
+ {
24
+ return "Pay ME " ;
25
+ }
26
+
22
27
23
28
}
24
29
?>
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ Routing is a very essential part of a Web Application. CogentPHP has an simple y
29
29
<?php
30
30
31
31
/** Autoloading The required Classes **/
32
-
32
+
33
33
use Core\Core\C_Base;
34
34
use Core\Core\Redirect;
35
35
@@ -47,6 +47,40 @@ Routing is a very essential part of a Web Application. CogentPHP has an simple y
47
47
Init::view('index');
48
48
}
49
49
50
+ public function pay()
51
+ {
52
+ /** Initializing a index.html view Found in (Views/index.html) **/
53
+ Init::view('index');
54
+ }
55
+
56
+ public function withdraw()
57
+ {
58
+ /** Initializing a index.html view Found in (Views/index.html) **/
59
+ Init::view('index');
60
+ }
50
61
51
62
}
52
63
?>
64
+
65
+ To generate URL from the Above controller, We have
66
+
67
+ localhost/account/
68
+ The URL Maps to accountController -> index()
69
+ Since no Method is Specified in URL, It maps it to index method by default.
70
+
71
+ localhost/account/pay
72
+ This URL Maps to accountController -> pay()
73
+ localhost/account/withdraw
74
+ This URL Maps to accountController -> withdraw()
75
+ localhost/account/begin
76
+ This results in a 404 error, Because the method begin() doesn't exist in the Class
77
+
78
+
79
+ The URL is Case Insensitive as:
80
+
81
+ accountController -> withdrawMoney() ==
82
+
83
+ 1. localhost/account/withdrawmoney
84
+ 2. localhost/account/withdrawMoney
85
+
86
+ They Both Evaluate to the same Method
You can’t perform that action at this time.
0 commit comments