[PHP]36.使用include的方式-可用在頁面重複的地方(例如header,footer)-直接include嵌入進來

  • 3204
  • 0
  • php
  • 2022-12-03

文、意如

s1.php


<html>
  <head>
    <title>mytest</title>
  </head>
  <body>
header

<?php
$myname="John";

?>
  </body>
</html>

s2.php

<?php 
include 's1.php';

echo $myname;
?>
<html>
  <head>
    <title>mytest</title>
  </head>
  <body>
	Hello page2
  </body>
</html>

 

 

 

 

 

 

參考s1.php

參考s2.php

 

 

Yiru@Studio - 關於我 - 意如