output_add_rewrite_var()
As documented here
This function adds another name/value pair to the URL rewrite mechanism. The name and value will be added to URLs (as GET parameter) and forms (as hidden input fields).
So the following code is supposed to do the trick
<?php
output_add_rewrite_var('var', 'value');
echo '<a href="test.php">link</a>';
echo '<form action="test.php" method="post">
<input type="text" name="var2" />
</form>';
?>
On form
it works fine, and add a hidden field. But the URL( a
tag) is still the same.
http://localhost/test.php
I'm expecting
http://localhost/test.php?var=value
How to fix this?
It seems that if you're using PHP >= 7.1.0 the default tag in url_rewriter.tags
is form
.
So what you're gonna have to do is change this line in php.ini
file:
;url_rewriter.tags
To:
url_rewriter.tags = "a=href,area=href,frame=src,form=,fieldset="
Note: The semicolon at the beginning of the line must be removed
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.