Create API Framework
This commit is contained in:
parent
fc56d79b6c
commit
ccdca161db
12
htdocs/.htaccess
Normal file
12
htdocs/.htaccess
Normal 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]
|
15
htdocs/API/v2/index.php
Normal file
15
htdocs/API/v2/index.php
Normal 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();
|
Loading…
x
Reference in New Issue
Block a user