분류
php
BR -> 새라인으로 변환
본문
BR태그를 새라인으로 변환하는 방법들입니다.
1.
function br2newline( $input ) {
$out = str_replace( "<br>", "\n", $input );
$out = str_replace( "<br/>", "\n", $out );
$out = str_replace( "<br />", "\n", $out );
$out = str_replace( "<BR>", "\n", $out );
$out = str_replace( "<BR/>", "\n", $out );
$out = str_replace( "<BR />", "\n", $out );
return $out;
}
2.
function br2nl( $input ) {
return preg_replace('/<br(\s+)?\/?>/i', "\n", $input);
}
3.
function _br2nl($input)
{
return str_replace(array(“<br>”, “<BR>”, “<br/>”, “<BR/>”, “<br />”, “<BR />”),”\n”, $input );
}
4.
function _br2nl($input)
{
return str_replace(array('', '', ''),'\n', strtolower($input) );
}
- 이전글e-mail 보내기 15.05.07
- 다음글dd/mm/yyyy에서 yyyy-mm-dd타입으로 날짜 변경 15.05.07