比方說,我有一個虛擬網站的網址:http://company.com/something。 我需要抓住路徑:/東西,並使用開關大小寫重定向到一個新的URL使用JavaScript。 有人能指導我嗎? var URL;
var url_param = location.pathname;
switch(url_param) {
case "/how-to-do-this":
是否有一些本地函數(shell,linux命令)合併/計算完整路徑? 例如: old_path="~/test1/test2/../dir3//file.txt"
new_path=FUN($old_path)
echo "$new_path" // I want get this "/home/user/test1/dir3/file.txt"