:PHPのフロントエンドで余分なスペースを節約する方法は?私は、データベースに格納されている正確な文字列以下のいる
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
は、余分なスペースと、私は、文字列に追加した余分な段落/改行に注意してください。
私はこのデータをecho nl2br($val);
を使って示していますが、段落改行は保持されていますが、文字列内の余分なスペースは削除されています。
どうすればこの問題を解決できますか。
参照:http:// stackoverflow。com/q/2300142/3933332 – Rizier123
これは本当に[tag:html]より[tag:php]ともっと関係があります... – deceze
本当の質問はあなたがこれをしたい理由です - あなたのテキストをフォーマットしようとしているなら空白のブロックを入れると間違ったことになります。 HTMLとCSSで利用可能なすべての書式設定機能では、スペース文字でそれをしようとする理由はほとんどありません。あなたが与えた例は、明らかにあなたが達成しようとしているものの正確な表現ではないので、私はさらに進んでそれをどうするべきか言っても難しいですが、スペースは答えではありません。 – Simba