Added namespacing
This commit is contained in:
parent
6674759d96
commit
545d321e0d
|
@ -12,6 +12,7 @@ The third argument will match the request method. The default method is 'get'.
|
||||||
|
|
||||||
## Simple example:
|
## Simple example:
|
||||||
```php
|
```php
|
||||||
|
use SteamPixel\Route;
|
||||||
include 'Route.php';
|
include 'Route.php';
|
||||||
|
|
||||||
Route::add('/user/([0-9]*)/edit', function($id) {
|
Route::add('/user/([0-9]*)/edit', function($id) {
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace SteamPixel;
|
||||||
|
|
||||||
class Route {
|
class Route {
|
||||||
|
|
||||||
private static $routes = Array();
|
private static $routes = Array();
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// Use this namespace
|
||||||
|
use SteamPixel\Route;
|
||||||
|
|
||||||
|
// Include router class
|
||||||
|
include 'Route.php';
|
||||||
|
|
||||||
function navi() {
|
function navi() {
|
||||||
echo <<<EOD
|
echo <<<EOD
|
||||||
Navigation:
|
Navigation:
|
||||||
|
@ -23,9 +29,6 @@ function navi() {
|
||||||
EOD;
|
EOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include router class
|
|
||||||
include 'Route.php';
|
|
||||||
|
|
||||||
// Add base route (startpage)
|
// Add base route (startpage)
|
||||||
Route::add('/', function() {
|
Route::add('/', function() {
|
||||||
navi();
|
navi();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user