好吧,我確實有這個以下代碼從ob_get_clean()輸出刪除換行符
<?php
ob_start();
?>
codepad is an
online compiler/interpreter,
and a simple collaboration tool.
Paste
your code below,
and codepad wi
ll run
it and give you a short
URL you can use to share
it in chat or email
<?php
$str = str_replace('\r\n','',trim(ob_get_clean()));
echo $str;
?>
,你可以看到它是如何在這裏工作 http://codepad.org/DrOmyoY9
現在什麼,我想在這裏是從去除新行ob_get_clean()
的存儲輸出。
我幾乎環顧了互聯網上關於如何刪除字符串中的換行符,這是除了使用緩慢的preg_replace()
之外刪除換行符的常見和最快的方法。
爲什麼會發生這種情況?這已經是一個錯誤?或者我錯過了什麼?
\ r \ n是windows風格。如果用戶使用linux \ n會怎麼樣?最佳陣列(「\ r」,「\ n」) – 2012-07-12 07:45:15
謝謝你謝謝^^ – 2012-07-12 07:48:25
@Dreadedsemicolon請發表您的答案我會接受它 – 2012-07-12 08:01:37