更新时间:2023-02-26 14:06:36
您要的是后端还是前端?您声明在后端需要它,但是问题仅用jquery标记. 另外,无论用户是在后端执行此检查,因为用户可能会绕过javascript
Did you want this is backend or frontend? You state you need it in backend, but question is only tagged with jquery. Also, you should be doing this check is backend regardless, since users can possibly circumvent javascript
if(url.substr(0,7) != 'http://'){
url = 'http://' + url;
}
if(url.substr(url.length-1, 1) != '/'){
url = url + '/';
}