Global

ไฟล์ global.php จะถูก include ในทุกคำขอ (ดู index.php) เหมาะสำหรับฟังก์ชันหรือ middleware ที่ต้องใช้ทุกหน้า เช่น ตรวจ session, ตั้งค่าคงที่, helper เพิ่มเติม.

ตัวอย่าง

<?php
// global.php
function isLogin(){ return isset($_SESSION['user']); }