output_add_rewrite_var
output_add_rewrite_var
Add URL rewriter values
bool **output_add_rewrite_var** string $name string $value
This function starts the output buffer handler
if it is not active,
stores the and parameters,
and when the buffer is flushed rewrites the s
and forms based on the applicable ini settings.
Subsequent calls to this function will store all additional name/value pairs
until the handler is turned off.
'URL-Rewriter'``name``value
When the output buffer is flushed (by calling , , or at the end of the script) the handler adds the name/value pairs as query parameters to s in attributes of HTML tags and adds hidden fields to forms based on the values of the and
configuration directives.
ob_flush``ob_end_flush``ob_get_flush``'URL-Rewriter'url_rewriter.tagsurl_rewriter.hosts
Each name/value pair added to the handler
is added to the s and/or forms
even if this results in duplicate query parameters
or elements with the same name attributes.
'URL-Rewriter'
Opmerking: > Once the handler has been turned off it cannot be started again.
'URL-Rewriter'
Waarschuwing: > Prior to PHP 8.4.0, the hosts to be rewritten were set in
instead of .session.trans_sid_hostsurl_rewriter.hosts
nameThe variable name.
valueThe variable value.
return.success
Voorbeeld: example
<?php
ini_set('url_rewriter.tags', 'a=href,form=');
output_add_rewrite_var('var', 'value');
// some links
echo '<a href="file.php">link</a>
<a href="http://example.com">link2</a>';
// a form
echo '<form action="script.php" method="post">
<input type="text" name="var2" />
</form>';
print_r(ob_list_handlers());
?>
<a href="file.php?var=value">link</a>
<a href="http://example.com">link2</a>
<form action="script.php" method="post">
<input type="hidden" name="var" value="value" />
<input type="text" name="var2" />
</form>
Array
(
[0] => URL-Rewriter
)
output_reset_rewrite_vars``ob_flush``ob_list_handlersurl_rewriter.tagsurl_rewriter.hosts