# Hello Think
復制官方的public模板至api目錄。
index.php 入口文件
~~~php
<?php
// 定義應用目錄
define('APP_PATH', __DIR__ . '/../app/');
// 加載框架引導文件
require __DIR__ . '/../thinkphp/start.php';
~~~
.htaccess apache url重寫文件
~~~xml
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
~~~
favicon.ico 網站圖標(可選)
robots.txt (可選)
復制官方的application模板至app目錄。
common.php 共用文件,暫時為空
config.php 配置文件,使用官方默認的文件
database.php 數據庫配置文件,使用官方默認的文件
route.php 路由配置文件,使用官方默認的文件
諾用IDE打開的是app目錄 請添加thinkphp的庫


建立控制器Index,路徑為 app/index/controller/Index.php
~~~php
<?php
namespace app\index\controller;
class Index
{
public function index($name = 'Thinkphp5')
{
return 'Hello ' .$name. '.';
}
}
~~~
訪問URL
http://api.imba.cn/
http://api.imba.cn/index/
http://api.imba.cn/index/index/
http://api.imba.cn/index/index/index.html
都能看到正確的結果

傳入參數,改變名字
http://api.imba.cn/index/index/index.html?name=bill
http://api.imba.cn/index/index/index/name/bill
