我需要重复19个字符串,如下所示生成站点地图; mysite.com/especialidad/policia。我需要将它与60个参数结合起来,例如?region = madrid,?region = barcelona。
所以我需要生成19 * 60(1140),如mysite.com/especialidad/policia/?region=barcelona。
有什么想法吗?
答案 0 :(得分:1)
<强> PHP 强>:
$myArray = ( "madrid", "barcelona", "...");
foreach($myArray as $e) {
echo "mysite.com/especialidad/policia?region=".$e;
}
<强>爪哇强>:
String[] myArray = {"madrid", "barcelona", "..."};
for (int i=0; i<myArray.length; i++) {
System.out.println("mysite.com/especialidad/policia?region="+myArray[i]);
}
<强>的Python 强>:
myArray = ['madrid', 'barcelona', '...']
for e in array:
print 'mysite.com/especialidad/policia?region=',e
<强>的JavaScript 强>:
var index;
var myArray = ["madrid", "barcelona", "..."];
for (index = 0; index < myArray.length; index++) {
console.log('mysite.com/especialidad/policia?region='+a[index]);
}
<强>的Perl 强>:
my @myArray = ("madrid", "barcelona", "...");
foreach (@myArray) {
print "$_<br>\n";
}