“Dlaczego warto używać OB_START () w PHP” Kod odpowiedzi

Dlaczego warto używać OB_START () w PHP

//why use ob_start() in php

<?php
ob_start(); //Start remembering everything that would normally be outputted, but don't quite do anything with it yet
$output = ob_get_contents(); //Gives whatever has been "saved"
ob_end_clean(); //Stops saving things and discards whatever was saved
ob_flush(); //Stops saving and outputs it all at once

?>
Mr. Samy

OB_START w PHP

ob_start(); //Start remembering everything that would normally be outputted, but don't quite do anything with it yet
$output = ob_get_contents(); //Gives whatever has been "saved"
ob_end_clean(); //Stops saving things and discards whatever was saved
ob_flush(); //Stops saving and outputs it all at once
MeVyom

PHP OB_START

<?php ob_start(); ?>

<div>
    <p>Here go your view</p>
</div>

<?php $content = ob_get_clean(); //now you can echo the content in base.php ?>
<?php require( __DIR__ . './base.php'); ?>
Thibaudkhan

Odpowiedzi podobne do “Dlaczego warto używać OB_START () w PHP”

Pytania podobne do “Dlaczego warto używać OB_START () w PHP”

Więcej pokrewnych odpowiedzi na “Dlaczego warto używać OB_START () w PHP” w PHP

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu