# 路由基礎
## 介紹
在Lolly框架下,要訪問一個頁面,我們需要配置路由。
## 路由配置
配置單個路由:
~~~
$lolly->route('/','index');
~~~
配置多個路由:
~~~
$lolly->routeList({
'/' => 'index',
'/hello' => 'hello'
});
~~~
直接讀取route.php配置文件
~~~
$lolly->routeConf();
~~~
僅僅配置了路由還不夠,因為程序并不知道當頁面被訪問時需要做什么:
一個完整的例子,當根目錄被訪問時,頁面輸出"hello world"
~~~
$lolly->route('/','index');
function index(){
return 'hello world';
}
~~~