프로그래밍
PHP-태그를 없애고 싶을 때
밍딩이
2016. 6. 23. 17:18
PHP-태그를 없애고 싶을 때
태그를 없애고 싶을 때는 strip_tags() 함수를 사용합니다.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>태그를 없애고 싶을 때</title>
</head>
<body>
<div>
<p>strip_tags() 함수에서 태그를 제거하기<br>
<?php
// h() 함수 레시피 218를 불러옵니다 레시피 041.
require_once '../../../../lib/h.php';
if (isset($_POST['example'])) {
echo h(strip_tags($_POST['example']));
}
?>
</p>
<form method="post" action="stript_tags.php">
<input type="text" name="example" value="<b>테스트</b>">
<input type="submit" name="submit" value="전송">
</form>
</div>
</body>
</html>