Updated README.md

Added example for routing object methods
pull/246/head
Yuriy Tkachenko 9 years ago
parent 8bd0bdd0b6
commit eaa9c99dd7

@ -113,7 +113,24 @@ class Greeting {
}
}
Flight::route('/', array('Greeting','hello'));
Flight::route('/', array('Greeting', 'hello'));
```
Or an object method:
```php
class Greeting
{
public function __construct() {
$this->name = 'John Doe';
}
public function hello() {
echo "Hello, {$this->name}!";
}
}
Flight::route('/', array(new Greeting, 'hello'));
```
Routes are matched in the order they are defined. The first route to match a

Loading…
Cancel
Save