Created
March 7, 2014 19:49
-
-
Save indeyets/9418561 to your computer and use it in GitHub Desktop.
Example of simple PHP application conversion to use https://github.com/indeyets/appserver-in-php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/************************** | |
* aip variant of php file | |
**************************/ | |
class MyApp | |
{ | |
public function __invoke($context) | |
{ | |
$output = '<h1>Hello world</h1>'; | |
if (isset($context['_GET']['name'])) { | |
$name = $context['_GET']['name']; | |
$output .= "<p>(hello to {$name} too</p>"; | |
} | |
$headers = array( | |
'Content-type', 'text/html; charset=utf-8', | |
'Content-Length', strlen($output), | |
); | |
return array(200, $headers, $output); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********************** | |
* usual php file | |
**********************/ | |
header('Content-type: text/html; charset=utf-8'); | |
echo "<h1>Hello world</h1>"; | |
if (isset($_GET['name'])) { | |
$name = $_GET['name'] | |
echo "<p>(hello to {$name} too</p>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment