Configuración en tiempo de ejecución
El comportamiento de estas funciones se ve afectado por la configuración de php.ini.
Para más detalles y definiciones de los modos de
INI_*, vea
Dónde se puede realizar un ajuste de configuración.
He aquí una breve explicación de
las directivas de configuración.
-
output_buffering
bool/int
-
Output buffering for all files can be enabled by setting this directive
to "On"
.
To limit the size of the buffer, a number/quantity corresponding to the
maximum numbers of bytes allowed can be used instead of
"On"
for the value of this directive.
For example output_buffering=4096
.
This directive is always Off in PHP-CLI.
-
output_handler
string
-
The output of scripts can be redirected to a function.
For example setting output_handler
to mb_output_handler(), character encoding will be
transparently converted to the specified encoding.
Setting any output handler automatically turns on output buffering.
Nota:
mb_output_handler() and
ob_iconv_handler() cannot be used together
and ob_gzhandler() and
zlib.output_compression
cannot be used with any of the following:
mb_output_handler(),
ob_gzhandler(),
zlib.output_compression,
the 'URL-Rewriter' handler
(see session.use_trans_sid
and output_add_rewrite_var()).
Nota:
Only built-in functions can be used with this directive.
For user defined functions, use ob_start().
-
implicit_flush
bool
-
false
by default. Changing this to true
tells PHP to tell the
output layer to flush itself automatically after every output block.
This is equivalent to calling the PHP function
flush() after each and every call to
any function producing output (such as
print or echo)
and each and every HTML block.
When using PHP within an web environment, turning
this option on has serious performance implications and is generally
recommended for debugging purposes only. This value defaults to
true
when operating under the CLI SAPI
.
See also ob_implicit_flush().
-
url_rewriter.tags
string
-
url_rewriter.tags
specifies HTML tags and attributes
in which URLs are rewritten by output_add_rewrite_var() values.
Defaults to "form="
.
Adding "form="
or any form
attribute
will add a hidden input
element to the form
with a name and value attribute for each name-value pair passed to
output_add_rewrite_var().
Precaución
Adding the same tag more than once to url_rewriter.tags
will only use the first occurence during the URL rewriting process.
Nota:
Prior to PHP 7.1.0, url_rewriter.tags
was used to specify session.trans_sid_tags.
-
url_rewriter.hosts
string
-
url_rewriter.hosts
specifies which hosts are
rewritten to include output_add_rewrite_var() values.
Defaults to $_SERVER['HTTP_HOST']
.
Multiple hosts can be specified by a comma separated list
that does not include spaces.
For example "php.net,wiki.php.net,bugs.php.net"
.
support at losalgendesign dot com ¶11 years ago
Using "OFF" or no value on output_buffering will disable header modifications, like redirects or content-type or content-disposition resulting in the error we commonly attribute to output before header modifications:
Warning: Cannot modify header information - headers already sent by (output started at C:\PATH\filename.php:1) C:\PATH\filename.php on line 1
Example code with output_buffering = OFF which results in this behavior. Changing it to "ON" or giving it a value will likely cause normal behavior.
<?php header("Location: http://www.php.net"); ?>
or
<?php header("Content-Type: text/Calendar"); ?>
<?php header("Content-Disposition: inline; filename=appointment.ics"); ?>