function test(id) {
var str = "{:url('documents/edit', ['id'=>'pid'])}";
var url=str.replace('pid',id);
//或者
str = '{:url("documents/edit?id=")}'+id;
str = "{:url('documents/add')}?"+"id="+id;
window.location.href=url;
}
博客列表 >tp5中在js函数中给url传参数并进行连接
function test(id) {
var str = "{:url('documents/edit', ['id'=>'pid'])}";
var url=str.replace('pid',id);
//或者
str = '{:url("documents/edit?id=")}'+id;
str = "{:url('documents/add')}?"+"id="+id;
window.location.href=url;
}