skymvc开发手册之url路由
4.11 skymvc的url路由
路由文件位于 skymvc/function/fun_url.php
1.配置 config/config.php
<?php define("REWRITE_ON",1); define("REWRITE_TYPE","pathinfo"); ?>
2.在control中使用
<?php class indexControl extends skymvc{ function __construct(){ parent::__construct(); } public function onDefault(){ $this->smarty->assign(array( "id"=>123, "u1"=>R("/index.php?m=a"), "u2"=>R("/index.php?m=a&a=abc&d=e&f=g&j=1&k=1&z=1") )); $this->smarty->display("index.html"); } } ?>
3.在模板中使用
<a href="{R("/index.php?m=a")}">index.php?m=a</a><br> <a href="{R("/index.php?m=a&a=abc&id=$id")}">index.php?m=a&a=abc </a><br> <a href="{R("/index.php?m=a&a=abc&d=e&f=$g")}">index.php?m=a&a=abc&d=3&f=g</a><br> <a href="{R("/index.php?m=a&a=abc&d=e&f=g&j=1&k=1&z=1")}">index.php?m=a&a=abc&d=3&f=g</a><br>