1
我在PHP中有一個變量的問題,我想從字符串中刪除第一個和最後一個\ n,但不是文本中的\ n。如何從字符串中刪除第一個和最後一個 n? PHP
如:
<--------------\n //I want to remove this (if exists)
some text \n
some text \n
<--------------\n //I want to remove this (if exists)
任何想法?
'trim()'你的字符串 – Rizier123
謝謝!我認爲修剪會刪除所有\ n ... –
修剪也刪除空格,標籤空間和其他,你應該看看[trim()](http://php.net/manual/en/function.trim。 PHP) –