Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はphp文字列としてhtmlテンプレートを持っています。出力を防ぐには、htmlオープニングまたはdoctype定義の前のすべての空白文字と改行を削除する必要があります。PHPでこれを行う最も簡単で最速の方法は何ですか?
あなたの質問を単に「文字列の先頭から空白を削除するにはどうすればよいですか」と解釈すると、答えは簡単です。
$str = trim($str);
ある種のMVCフレームワークを使用している場合は、ビューでoutputメソッドを見つけて、文字列をトリミングします。