Tutorial PHP

PHP INICIO Introducción PHP Instalación de PHP Sintaxis PHP Comentarios PHP Variables PHP PHP Echo / Imprimir Tipos de datos PHP Cadenas PHP Números PHP Matemáticas PHP Constantes PHP Operadores PHP PHP Si... Más... Elseif Cambio de PHP Bucles de PHP Funciones PHP Matrices de PHP Superglobales de PHP PHP expresión regular

Formularios PHP

Manejo de formularios PHP Validación de formulario PHP Formulario PHP requerido Formulario PHP URL/Correo electrónico Formulario PHP completo

PHP Avanzado

Fecha y hora PHP PHP Incluir Manejo de archivos PHP Archivo PHP Abrir/Leer Archivo PHP Crear/Escribir Carga de archivos PHP Cookies PHP Sesiones PHP Filtros PHP Filtros PHP avanzados Funciones de devolución de llamada de PHP PHPJSON Excepciones de PHP

POO de PHP

PHP ¿Qué es la programación orientada a objetos? Clases PHP/Objetos Constructor PHP Destructor PHP Modificadores de acceso de PHP Herencia de PHP Constantes PHP Clases abstractas de PHP Interfaces PHP Características de PHP Métodos estáticos de PHP Propiedades estáticas de PHP Espacios de nombres de PHP Iterables de PHP

Base de datos MySQL

Base de datos MySQL Conexión MySQL MySQL Crear base de datos Crear tabla MySQL MySQL Insertar datos MySQL Obtener la última identificación MySQL Insertar Múltiples MySQL preparado Datos seleccionados de MySQL mysql donde MySQL Ordenar por MySQL Eliminar Datos Datos de actualización de MySQL Límite de datos de MySQL

PHPXML _

Analizadores PHP XML Analizador PHP SimpleXML PHP SimpleXML - Obtener PHP XML Expatriados PHP XML DOM

PHP -AJAX

Introducción a AJAX AJAXPHP Base de datos AJAX XML AJAX Búsqueda en vivo de AJAX Encuesta AJAX

Ejemplos de PHP

Ejemplos de PHP Compilador PHP Cuestionario de PHP Ejercicios PHP Certificado PHP

Referencia PHP

Descripción general de PHP Matriz de PHP Calendario PHP Fecha PHP Directorio PHP Error PHP Excepción PHP Sistema de archivos PHP Filtro PHP PHPFTP PHPJSON Palabras clave PHP PHP Libxml Correo PHP Matemáticas PHP PHP misceláneo PHP MySQLi Red PHP Control de salida de PHP PHP expresión regular PHP SimpleXML flujo PHP Cadena PHP Manejo de variables de PHP Analizador PHP XML código postal de PHP Zonas horarias de PHP

Funciones de control de salida de PHP


Funciones de control de salida de PHP

PHP proporciona un conjunto de funciones que controlan qué contenido se envía al navegador y cuándo. Esto se conoce como control de salida .

La salida puede provenir de cualquiera de las siguientes fuentes:

  • echo, print, printf, print_r... y otras funciones y sentencias similares
  • Avisos, advertencias y errores de PHP
  • Cualquier contenido fuera de las <?php ?>etiquetas

PHP y el backend en el que se ejecuta pueden contener la salida en un búfer antes de enviarla al usuario.

Nota: Las funciones de control de salida pueden crear cualquier número de búferes de salida. Los búferes de salida capturan la salida proporcionada por el programa. Cada nuevo búfer de salida se coloca en la parte superior de una pila de búferes de salida, y cualquier resultado que proporcione será capturado por el búfer debajo de él. Las funciones de control de salida manejan solo el búfer superior, por lo que el búfer superior debe eliminarse para controlar los búfer inferiores.

Instalación

Las funciones de control de salida de PHP son parte del núcleo de PHP. No se requiere instalación para utilizar estas funciones.


Configuración de tiempo de ejecución

El comportamiento de las funciones de control de salida se ve afectado por la configuración en php.ini:

Name Default Description Version
output_buffering "0" Enables output buffering for all PHP files by default 4
output_handler NULL Set the name of the default function which handles the output of all output buffers 4
implicit_flush "0" Enables implicit flush, which causes output to be sent directly to the browser on each output statement 4
url_rewriter.tags "a=href,area=href, frame=src,form=,fieldset=" Indicates which HTML tags and attributes can be modified by the URL rewriter (the output_add_rewrite_var() function.) 4.3
url_rewriter.hosts The current value of $_SERVER['HTTP_HOST'] URL rewriting is only done on the server's own URLs by default. To allow for rewriting URLs of other websites, set the hostnames of the other websites here. 7.1

Funciones de control de salida de PHP

Method Function
flush() Attempts to send content from the system's output buffer to the browser
ob_clean() Deletes all of the content from the topmost output buffer
ob_end_clean() Deletes the topmost output buffer and all of its contents
ob_end_flush() Deletes the topmost output buffer and outputs its contents
ob_flush() Outputs the contents of the topmost output buffer and clears the buffer
ob_get_clean() Returns all of the contents of the topmost output buffer and clears the buffer
ob_get_contents() Returns the contents of the topmost output buffer
ob_get_flush() Outputs and returns the contents of the topmost output buffer and then deletes the buffer
ob_get_length() Returns the number of bytes of data that are in the topmost output buffer
ob_get_level() Returns a number indicating how many output buffers are on the stack
ob_get_status() Returns information about the output buffers
ob_gzhandler() Used as a callback function for ob_start() to compress the contents of the buffer when sending it to the browser
ob_implicit_flush() Turns implicit flushing on or off
ob_list_handlers() Returns an array of callback function names that are being used by the topmost output buffer
ob_start() Creates a new output buffer and adds it to the top of the stack
output_add_rewrite_var() Used to append query string parameters to any URL in the output
output_reset_rewrite_vars() Removes all variables added by output_add_rewrite_var()