Create API Framework

This commit is contained in:
Yuan Chiu 2014-11-09 17:03:48 +08:00
parent fc56d79b6c
commit ccdca161db
3 changed files with 27 additions and 0 deletions

12
htdocs/.htaccess Normal file
View File

@ -0,0 +1,12 @@
# 不允許列出目錄
Options -Indexes
# ---------------------------------------------------------
# 網址改寫
RewriteEngine On
## For API
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (API|api)/v2/(.*)$ API/v2/index.php/$1 [L]

View File

15
htdocs/API/v2/index.php Normal file
View File

@ -0,0 +1,15 @@
<?php
require_once __DIR__.'/../../config.php';
require UELEARNING_ROOT.'/vendor/autoload.php';
$app = new \Slim\Slim();
$app->get('/', function () {
echo "Test";
});
$app->get('/hello/:name', function ($name) {
echo "Hello, $name";
});
$app->run();