猿问

typecho的路由规则是啥?

Typecho/Router/Parser.php中的parse方法里面的正则表达式是啥意思?
附代码:
publicfunctionparse()
{
$result=array();
foreach($this->_routingTableas$key=>$route){
$this->_params=array();
//在_routingTables,[regx]=>|^/attachment/([0-9]+)[/]?$|
$route['regx']=preg_replace_callback("/%([^%]+)%/",array($this,'_match'),
//[url]=>/attachment/[cid:digital]/
preg_quote(str_replace(array('[',']',':'),array('%','%',''),$route['url'])));
/**处理斜线*/
$route['regx']=rtrim($route['regx'],'/');
$route['regx']='|^'.$route['regx'].'[/]?$|';
$route['format']=preg_replace("/\[([^\]]+)\]/","%s",$route['url']);
$route['params']=$this->_params;
$result[$key]=$route;
}
return$result;
}
慕姐4208626
浏览 329回答 2
2回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答