[removed] get url path

后端 未结 4 1955
借酒劲吻你
借酒劲吻你 2020-12-30 05:44
var url = \'http://domain.com/file.php?id=1\';

or

var url = \'https://domain.us/file.php?id=1\'

or



        
4条回答
  •  时光取名叫无心
    2020-12-30 06:12

    this version is with regex. Try this out:

    var splittedURL = url.split(/\/+/g);
    var path = "/"+splittedURL[splittedURL.length-1];
    

提交回复
热议问题