|
|
|
|
|
by Cafesolo
5672 days ago
|
|
Another nice, little PHP framework is GluePHP (http://gluephp.com). Hello World using GluePHP: <?php
require_once('glue.php');
$urls = array(
'/' => 'index'
);
class index {
function GET() {
echo "Hello, World!";
}
}
glue::stick($urls);
?>
Another example with parameter matching and POST method handling: <?php
require_once('glue.php');
$urls = array(
'/' => 'index',
'/(?P<number>\d+)' => 'index'
);
class index {
function GET($matches) {
if (array_key_exists('number', $matches)) {
echo "The magic number is: " . $matches['number'];
} else {
echo "You did not enter a number.";
}
}
function POST() {
echo 'The value you entered was ' . $_POST['textbox1'];
}
}
glue::stick($urls);
?>
|
|