include_once

include_once

include_once

Function

The BT file is introduced and executed at runtime, but the same real file is only executed once within the current execution context.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
pathStringYesNoneThe path of the BT file to be imported.

Return value

TypeDescription
Any/EmptyReturns the return value of the imported file when executed for the first time; returns Empty when the same real file is imported repeatedly.

Example

Notes

  • Repeated judgment uses the normalized real file path instead of the original string path.
  • The once state belongs only to the current execution context; the state is re-created with every request to the Web and every call to the desktop bt.call().
  • include_once shares the file compilation cache, but does not cache variable scopes, return values, or execution status.
  • Bracketless syntax only supports statement form; please use include_once(path) when you need to assign the return value to a variable.