Skip to content

Commit a1505a1

Browse files
authored
Update php_array_to_txt.php
1 parent c578ca6 commit a1505a1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

api/php_array_to_txt.php

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
$user_path_2 = $_POST["user_path_2"]??'';
55
$arr_data = $_POST["arr_data"]??'';
66
$scheme = $_POST["scheme"]??'';
7+
$scheme2 = $_POST["scheme2"]??'';
78
if (strlen($user_path_1)>100||strlen($user_path_2)>40) {
89
die("Path or suffix's length has exceeded!");
910
} else if (empty($arr_data)) {
@@ -14,6 +15,13 @@
1415
} else {
1516
$pattern = "/.+>.*['\"](\S+)['\"].*\/\/(.*)/";
1617
}
18+
if ($scheme2 == ''){
19+
$arr_data = preg_replace("/.*\/\/.+>.+/",'',$arr_data);
20+
$arr_data = preg_replace("/.*#.+>.+/",'',$arr_data);
21+
$arr_data = preg_replace("/.*\/\*.+>[^\*]+\*\//",'',$arr_data);
22+
} else {
23+
$arr_data = str_replace('*/','',$arr_data);
24+
}
1725
if (preg_match_all($pattern,$arr_data,$matches)){
1826
for($i = 0; $i < count($matches[1]); $i++){
1927
echo $matches[2][$i].','.$user_path_1.$matches[1][$i].$user_path_2.PHP_EOL;

0 commit comments

Comments
 (0)