|
|
 |
nl2br (PHP 3, PHP 4 , PHP 5) nl2br --
Inserts HTML line breaks before all newlines in a string
Descriptionstring nl2br ( string string)
Returns string with '<br />' inserted
before all newlines.
注:
Starting with PHP 4.0.5, nl2br() is now XHTML
compliant. All versions before 4.0.5 will return
string with '<br>' inserted before
newlines instead of '<br />'.
例子 1. using nl2br() |
<?php
echo nl2br("foo isn't\n bar");
?>
|
this will output :
|
See also htmlspecialchars(),
htmlentities(),
wordwrap(), and
str_replace().
davidbullock at tech-center dot com
23-Nov-1999 03:06
If you use nl2br in conjunction with htmlspecialchars, you should process
the string with nl2br after htmlspecialchars to prevent htmlspecialchars
from escaping your newly generated symbols.
| |