ဖန်ရှင် get_included_files

ဖန်ရှင် get_included_files သည် လက်ရှိစကရစ်ပ်ထဲသို့ ချိတ်ဆက်ထားသော ဖိုင်အားလုံး၏ အပြည့်အစုံလမ်းကြောင်းများပါဝင်သည့် အခင်းအကျင်းတစ်ခုကို ပြန်ပေးသည်။ ၎င်းသည် အမှန်တကယ် မည်သည့်ဖိုင်များ လာရောက်တင်ထားသည်ကို စစ်ဆေးလိုသည့်အခါ debug လုပ်ရာတွင် အသုံးဝင်သည်။

ဖွဲ့စည်းပုံ

phpget_included_files();

နမူနာ

ရိုးရှင်းသော စကရစ်ပ်တစ်ခုထဲရှိ ချိတ်ဆက်ထားသော ဖိုင်များစာရင်းကို စစ်ဆေးကြည့်ရအောင်။

php<?php
  include 'header.php';
  require 'config.php';
  
  $res = get_included_files();
  print_r($res);
?>

ကုဒ်အလုပ်လုပ်ဆောင်မှု၏ ရလဒ်။

php[
  '/path/to/main.php',
  '/path/to/header.php',
  '/path/to/config.php'
]

နမူနာ

ချိတ်ဆက်ထားသော ဖိုင်အရေအတွက်ကို စစ်ဆေးကြည့်ရအောင်။

php<?php
  include 'functions.php';
  include_once 'utils.php';
  
  $res = count(get_included_files());
  echo $res;
?>

ကုဒ်အလုပ်လုပ်ဆောင်မှု၏ ရလဒ်။

php3

ဤအရာကိုလည်း ကြည့်ပါ

  • ဖန်ရှင် print_r,
    အပြောင်းအလဲတစ်ခုအကြောင်း အချက်အလက်များကို ထုတ်ပေးသည်
  • ဖန်ရှင် debug_backtrace,
    ခေါ်ဆိုမှုများ stack ကို ပြန်ပေးသည်