|
|
@ -113,7 +113,26 @@ 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}!";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$greeting = new Greeting();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Flight::route('/', array($greeting, 'hello'));
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Routes are matched in the order they are defined. The first route to match a
|
|
|
|
Routes are matched in the order they are defined. The first route to match a
|
|
|
|