Start and End Tags

จาก Wiki2

ข้ามไปที่: นำทาง, สืบค้น

หากคุณเคยทำเว็บด้วย HTML และ CSS มาแล้ว ก็ทำเหมือนเดิม เพียงแต่เปลี่ยนนามสกุลของ HTML file จาก .htm หรือ .html มาเป็น .php

จากนั้นเขียน PHP โปรแกรมใน HTML file โดยต้องห่อ PHP Code ใน Tag โดยต้องมี Opening Tag และ Close Tag ซึ่งมีหลายแบบ เพื่อไม่ให้สับสน จำแบบเดียวก็พอแล้ว คือ

Open Tag = <?php
Close Tag = ?>

ตัวอย่าง Code

<html>
<head>
<title>Sample php tag</title>
</head>
<body>
<?php
    //  This is the comment of PHP code
    echo "<P>I think this is really "cool PHP Code"!</P>";
?>
</body>
</html>

โปรดสังเกตุว่าทุกประโยคคำสั่งของ PHP จะต้องจบด้วยเครื่องหมาย ";"

รับข้อมูลจาก "http://www.noklek.com/wiki2/index.php/Start_and_End_Tags"
เครื่องมือส่วนตัว