问题
So I am submitting this link into my php code:
For some reason I cannot even use example.com in the url below, but just add the directory to the script before.
https://www.example.com/test.php?info1234=3177%3B315961%3B317451%3B315511&info3598=121618%3B136803%3B13830%3B20532
The above example.com url is 1 SINGULAR string. The user is ONLY submitted ONE thing. That one thing happens to be a php url which contains its own parameters.
However, when I submit it using the the form, I get this $_GET
array (This is my desired outcome but the other way is fine too):
Array
(
[myurl] => https://www.example.com/test.php?info1234=3177;315961;317451;315511
[info3598] => 121618;136803;13830;20532
)
And then if I submit it by putting the myurl into the actual url myself into my program's url myself. If I typed this url, and submitted it localhost/test.php?myurl=https://www.example.com/test.php?info1234=3177%3B315961%3B317451%3B315511&info3598=121618%3B136803%3B13830%3B20532
, I get this $_GET
array:
Array
(
[myurl] => https://www.example.com/test.php?info1234=3177%3B315961%3B317451%3B315511&info3598=121618%3B136803%3B13830%3B20532
)
test.php
<?php
print_r($_GET);
?>
<form action="test.php" method="get">
myurl: <input type="text" name="myurl"><br>
<input type="submit" value="Submit">
</form>
回答1:
Form submission - submits form data. You'll have to Add the extra parameter as a hidden input. ie:
<input type="hidden" id="info" name="info3595" value="entervaluehereinsuitalbleformat">
回答2:
try this:-
<form action="test.php" method="GET">
myurl: <input type="text" name="myurl"><br>
<input type="hidden" id="info" name="info1234" value="enter_value">
<input type="submit" value="submit">
</form>
i hope it's useful
来源:https://stackoverflow.com/questions/54438589/getting-a-unified-get-array-regardless-of-how-you-submit-information