Thuta Learning
ရှာဖွေရန်
AdvancedProgrammingbeginner

Include & Require

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

include နဲ့ require ကို repeated file pieces တွေကို ပြန်သုံးဖို့အသုံးပြုပါတယ်။ Header, footer, database connection, helper functions စတာတွေကို file ခွဲထားရင် project ကြီးလာတဲ့အခါ code ထိန်းရလွယ်ပါတယ်။

php
<!-- index.php -->
<?php include "partials/header.php"; ?>

<h1>Welcome to my website</h1>
<p>This page uses a reusable header and footer.</p>

<?php include "partials/footer.php"; ?>
You should see
Reusable header, content, footer တို့ပါသော page တစ်ခု render ဖြစ်မည်။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • User input ကို include path အဖြစ်တိုက်ရိုက်မသုံးပါနဲ့။ File inclusion vulnerability ဖြစ်နိုင်ပါတယ်။
Include & Require | Thuta Learning