Skip to content

Instantly share code, notes, and snippets.

@LinZap
Created November 15, 2015 15:50
Show Gist options
  • Save LinZap/0b0fb254b22e4a15e510 to your computer and use it in GitHub Desktop.
Save LinZap/0b0fb254b22e4a15e510 to your computer and use it in GitHub Desktop.
URL Routing
<?php
// 設定專案根目錄
Route::base("spa-new");
Route::status(404,"./layout/404.php");
// 首頁
Route::get("/",function($matchs,$query){
Route::render("./layout/home.php");
});
// 關於我
Route::get("about",function($matchs,$query){
Route::render("./layout/about.php");
});
// 作品
Route::get("work",function($matchs,$query){
Route::render("./layout/work.php");
});
// 聯繫
Route::get("contact",function($matchs,$query){
Route::render("./layout/contact.php");
});
?>
@LinZap
Copy link
Author

LinZap commented Nov 15, 2015

URL Routing

是 Awesome v2.2 的 Alpha 功能
上面展示是撰寫方法

lib 原始碼 GitHub

觀看 Demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment