如果有http://test.com/abc/xyz/1/2/3
这样的网址,如何在abc/
之后检索所有网址细分,以便得到的值为["xyz","1","2","3]
?
答案 0 :(得分:0)
如果将来有人偶然发现这一点,我已设法解决它:
processParams :: String -> Request -> Maybe [Param]
processParams s x = do
case (params', isPrefix) of
(_:paramsxs, True) -> return $ fmap (flip (,) $ "") paramsxs
_ -> Nothing
where
isPrefix = s `isPrefixOf` (convertString path) :: Bool
path = rawPathInfo x
params' = fmap convertString $ decodePathSegments path
并使用function
函数:
get (function $ processParams "/comparePackage") $ comparePackageHandler