"Nl2br()"의 두 판 사이의 차이

7번째 줄: 7번째 줄:
     return str.replace(/\n/g, "<br />");   
     return str.replace(/\n/g, "<br />");   
}   
}   
console.log( nl2br("Hello\nWorld") );
# Hello<br />World
</source>
</source>



2015년 9월 7일 (월) 18:44 판

nl2br()

1 JavaScript

function nl2br(str){  
    return str.replace(/\n/g, "<br />");  
}  

console.log( nl2br("Hello\nWorld") );
# Hello<br />World

2 PHP

echo nl2br("Hello\nWorld");
# Hello<br />
# World

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}