Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 25, 2019 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/4ead82e2c7f9fee255018f194c405f34 to your computer and use it in GitHub Desktop.
Save parzibyte/4ead82e2c7f9fee255018f194c405f34 to your computer and use it in GitHub Desktop.
<?php
$salida = "index.html";
ob_start();
include_once "index.php";
# ¿Expresiones regulares? ¿Optimización? aquí no hacemos eso.png
$contenido = ob_get_clean();
$contenido = str_replace("\n", "", $contenido);
$contenido = str_replace("\t", "", $contenido);
$contenido = str_replace("\t\t", "", $contenido);
$contenido = str_replace(" ", "", $contenido);
$escrito = file_put_contents("index.html", $contenido);
if ($escrito !== FALSE) {
echo "Contenido generado y guardado en $salida";
} else {
echo "Eror escribiendo en $salida";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment