我有一个多维数组。我想为数组中的每个值创建一个URL:
<?php
$myArray = [
[
'name' => ` d a`,
'surname' => `smith`,
'place' => `a us`,
],
[
'name' => `d a e`,
'surname' => `col`,
'place' => `e n g land`,
],
];
include 'index_common.php';
和其他文件index_common.php URL是
echo "<a href=http://place/surname_action.php><h1>name</h1></a>";
答案 0 :(得分:0)
我不确定您是否理解正确,但我想以下是解决您问题的方法:
请参阅-http://docs.php.net/manual/da/function.http-build-query.php
给定数组的函数会返回查询字符串,请参见php手册中的以下示例。
val text: String = "file-client-and-reports_20190512_010012_c.csv"
val text2 = text.replaceAll("""(?:_[0-9]+)+_c(?=\.[^.]+$)""","")
println(text2)
// => file-client-and-reports.csv
还支持复杂/嵌套的数组