我有一個空白問題,當我從數據庫回顯一個textarea的東西它增加了一些空格。Whitespaces與回聲(PHP)
當我使用trim()它只在開始時刪除空格,但仍然有一些剩餘。我無法把頭圍住它。
echo trim("[quote=".name($msg['naam'])."]\n".$msg['bericht']."[/quote]\n");
我用jQuery加載引述消息像這樣
function quoteMessage(pid){
$("#post2").addClass("click");
$(".label").addClass("hidden");
$.post('/action-handler.php', { action: 'quote_message', pid: pid}, function(response) {
if(response != 'ERR'){
$('#post2').val($('#post2').val()+response);
} else {
$('#response').css('display', 'block');
$("#response").append("<p class='good display-error'>An unexpected error occurred.</p>");
}
});
}
那最後只會刪除'\ n'嗎? – 2012-08-16 18:31:47
你可以顯示你的HTML嗎? – 2012-08-16 18:33:26
然後,你的html元素是什麼'#post2'? '/ action-handler.php'返回你寫的回顯? – 2012-08-16 18:38:56