PHP/Utility Function/ob start — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
| |
Текущая версия на 07:07, 26 мая 2010
Buffering output
<?php ob_start(); ?>
I haven"t decided if I want to send a cookie yet.
<?php setcookie("heron","great blue"); ?>
Yes, sending that cookie was the right decision.
<?php ob_end_flush(); ?>
Using a callback with ob_start()
<?php
function mangle_email($s) {
return preg_replace("/([^@\s]+)@([-a-z0-9]+\.)+[a-z]{2,}/is",
"<$1@...>",
$s);
}
ob_start("mangle_email");
?>
I would not like spam sent to ronald@example.ru!
<?php ob_end_flush(); ?>