我想要实现的是:
让inflector slug忽略字符串中的特殊字符,该字符通常会被替换为inflector slug的替换字符串。
例如,我希望忽略的字符:'/‘
输入:这是一个/example/
输出: this_is_an_example
我想要的输出: this_is_an_/example/
我在文档中找到了属性'_uninflected‘,但我认为它不是我要找的(也不会对我想要的东西起作用)。
发布于 2012-06-17 22:52:55
您可以对每个令牌进行分解和段塞。
$input='/hi/im/a/non inflected ùrl/:=D';
$tokens=explode('/',$input);
foreach($tokens as &$token) $token=Inflector::slug($token);
$output='this_is_an_'.implode('/',$tokens);https://stackoverflow.com/questions/10980893
复制相似问题