/**
* @property $strVal | String
* 把属性值转换成url格式的字符串,用于生成url.
*/
protected function actionAttrValConvertUrlStr($strVal)
{
if ($strVal) {
// if (!preg_match('/^[A-Za-z0-9-_ &]+$/', $strVal)) {
// throw new InvalidValueException('"'.$strVal .'":contain special str , you can only contain special string [A-Za-z0-9-_ &]');
// }
$strVal = urlencode($strVal);
$convert = $this->strUrlRelation();
foreach ($convert as $originStr => $nStr) {
$strVal = str_replace($originStr, $nStr, $strVal);
}
return $strVal;
}
}
如果我把这个函数重写成这样,就是不作判断直接用url转义应该不会出现什么问题吧,怕其他方面会出问题