file_get_contents는 파일 내에 있는 콘텐츠를 바로 불러 올 수 있는 기능을 가졌다.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>WEB</title>
</head>
<body>
<h1>WEB</h1>
<ol>
<a href="index.php?id=HTML"><li>HTML</li></a>
<a href="index.php?id=CSS"><li>CSS</li></a>
<a href="index.php?id=JavaScript"><li>JavaScript</li></a>
</ol>
<h2>
<?php
echo file_get_contents("data/".$_GET['id']);
?>
</h2>
</body>
</html>
댓글