[英]How to delete the whitespace from outputted mysql data
我如何修剪空白? 我已經嘗試過trim(),但是不起作用。 該錨標記數據來自數據庫(數據庫表中沒有空格)
嘗試這個,
trim(preg_replace('/\t+/', '', $string));
使用此功能:
function remove_internal_whitespace($string)
{
$string = preg_replace('/\s+/', ' ', $string);
$string = trim($string);
return $string;
}
用法:
echo remove_internal_whitespace(your html string here);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.