Hướng dẫn nl2br python - trăn nl2br
Hàm Show Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức.freetuts.net, không được copy dưới mọi hình thức. Cú phápCú pháp: Trong đó::
Ví dụCode echo "freetuts.net\n PHP functionn"; echo " Kết quả freetuts.net PHP functionn freetuts.net PHP functionn Code $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string); Kết quả Tham khảo: php.net Bài viết này được đăng tại [free tuts .net] ❮ Tham chiếu chuỗi PHPThí dụ Chèn ngắt dòng nơi xuất hiện dòng mới (\ n) trong chuỗi: Đầu ra trình duyệt của đoạn mã trên sẽ là: Đầu ra trình duyệt của đoạn mã trên sẽ là: One line. Another line. Đầu ra trình duyệt của đoạn mã trên sẽ là: One line. Another line.Đầu ra HTML của đoạn mã trên sẽ là (Xem Nguồn): Cú phápĐịnh nghĩa và Cách sử dụng
TRUE- Default. Inserts
Phiên bản PHP:❮ Tham chiếu chuỗi PHPThí dụ Chèn ngắt dòng nơi xuất hiện dòng mới (\ n) trong chuỗi: Đầu ra trình duyệt của đoạn mã trên sẽ là: Đầu ra trình duyệt của đoạn mã trên sẽ là: One line. Another line. Đầu ra trình duyệt của đoạn mã trên sẽ là: Bài viết này được đăng tại [free tuts .net] ❮ Tham chiếu chuỗi PHP Thí dụ — Inserts HTML line breaks before all newlines in a string Giá trị tham sốParameter(string DescriptionstringRequired. Specifies the string to check Optional. A boolean value that indicates whether or not to use XHTML compatible line breaks: TRUE- Default. InsertsFALSE - Inserts Chi tiết kỹ thuậtGiá trị trả lại:nl2br() freetuts.net PHP functionn freetuts.net PHP functionn6 Trả về chuỗi đã chuyển đổi Phiên bản PHP: freetuts.net PHP functionn freetuts.net PHP functionn8 Trả về chuỗi đã chuyển đổi Welcome Phiên bản PHP: freetuts.net PHP functionn freetuts.net PHP functionn9 Trả về chuỗi đã chuyển đổi This Phiên bản PHP:
(PHP 4, PHP 5, PHP 7, PHP 8) ¶ nl2br — Inserts HTML line breaks before all newlines in a string $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);0 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);1 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);2 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 nl2br(string Parameters $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);4 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);5 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);6 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 The input string. $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);8 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);9 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 Whether to use XHTML compatible line breaks or not. Welcome1 Return Values $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 Returns the altered string. ¶ Examples Welcome4 Welcome5 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 Example #1 Using nl2br() ¶ The above example will output: Welcome7 Welcome8 Welcome9 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 Example #2 Generating valid HTML markup using the Example #3 Various newline separators This1 This2 This3 This4 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 See Also ¶ Example #3 Various newline separators See Also This7 This8 This9 $string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 htmlspecialchars() - Convert special characters to HTML entities ¶ htmlentities() - Convert all applicable characters to HTML entities
nl2br() 4wordwrap() - Wraps a string to a given number of characters ¶ str_replace() - Replace all occurrences of the search string with the replacement string
$string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 CGameProgrammer at gmail dot com ¶ ¶ str_replace() - Replace all occurrences of the search string with the replacement string
3CGameProgrammer at gmail dot com ¶ ¶ 17 years ago
$string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 ngkongs at gmail dot com ¶ ¶ 15 years ago
$string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 N/A ¶ ¶ Whether to use XHTML compatible line breaks or not.
$string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 Return Values ¶ Returns the altered string. Examples
$string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 Example #1 Using nl2br() ¶ Parameters
$string = "This\r\nis\n\ra\nstring\r"; echo nl2br($string);3 |