/app/应用/config.php
比如:app/api/config.php
config/环境目录/common.config.php
如config/dev/common.config.php
'router' => [
'space' => 'space/index',
'archive/read' => 'article/index',
'search' => 'index/search'
]
访问:/space/1000010/ 就会访问到/space/index/1000010/
也就是访问到了space控制器中的index方法,并传入1000010这个值
比如space控制器如下
namespace app\web\controller;
use Timo\Core\Controller;
class Space extends Controller;
{
public function index($uid = 0)
{
var_dump($uid);
}
}
访问:http://www.timophp.com/space/1000010/
那么会输出:string(7) "1000010"
其实就是一个别名
怎样生成http://www.timophp.com/space/1000010/这样的链接呢?很简单
比如在模版里面:$this->link('space/index', ['uid' => 1000010]);
在控制器里面:$this->view->link('space/index', ['uid' => 1000010]);
`