function _suggest_url($action, $url) { $actionArr = explode('/', $action); $params = array_keys($url['vars']); $urlDepr1Params = []; $urlDepr2Params = []; if (!empty($params)) { foreach ($params as $param) { if(empty($url['vars'][$param]['require'])){ array_push($urlDepr1Params, "[:$param]"); }else{ array_push($urlDepr1Params, ":$param"); } array_push($urlDepr2Params, htmlspecialchars('<') . $param . htmlspecialchars('>')); } } if ($actionArr[2] == 'index') { $actionArr[1] = cmf_parse_name($actionArr[1]); return empty($params) ? $actionArr[1].'$' : ($actionArr[1] . '/' . implode('/', $urlDepr1Params) /*. '或' . $actionArr[1] . '-' . implode('-', $urlDepr2Params)*/); } else { $actionArr[2] = cmf_parse_name($actionArr[2]); return empty($params) ? $actionArr[2].'$' : ($actionArr[2] . '/' . implode('/', $urlDepr1Params) /*. '或' . $actionArr[2] . '-' . implode('-', $urlDepr2Params)*/); } } function _url_vars($url) { if (!empty($url['vars'])) { return implode(',', array_keys($url['vars'])); } return ''; }

##### 1

| URL | URL名称 | 参数 | 建议优化
--- | --- | --- | --- | ---
$statuses=array('0'=>"已禁用","1"=>"已启用"); $types=array('1'=>"自定义","2"=>"别名定义");
$suggestUrl=_suggest_url($action,$vo);
| {$action} | {$vo.name} | {:_url_vars($vo)} | {$suggestUrl}