هرکدام برای چه کاری مناسبند؟

milads

Banned
دوست عزیز فرق این 3 تابع به این صورت هست
require_once و require در صورت نبودن فایل مذکور در دایرکتوری خطا میده .
include در صورت در صورت نبودن فایل مذکور در دایرکتوری خطا نمیده .
موفق باشید .
 

hidensoft

Member
این نکته رو اضافه کنم که requrie_once و include_once فقط یک بار یک فایل رو فراخوانی می کنند ، یعنی در صورتی که شنا یک بار دیگه با require یا include همون فایلی که قبلا فراخوانی کردید رو یک بار دیگه فراخوانی کنید ، دیگه فایل لود نمی شه و از اضافه کاری جلوگیری می شه .

include_once

[LTR]The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. As the name suggests, it will be included just once.[/LTR]

require_once
[LTR]The require_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the require() statement, with the only difference being that if the code from a file has already been included, it will not be included again. See the documentation for require() for more information on how this statement works.[/LTR]

موفق باشید
 
آخرین ویرایش:

جدیدترین ارسال ها

بالا