Documentation

GetFileRecursive

mixed
CMain::GetFileRecursive(
 string FileName,
 mixed dir
)

The method searches for a file recursively up the folder hierarchy. If the file is found - returns path to the found file relative to the root, otherwise returns false. Non-static method.

Parameters

ParameterDescription
FileName File name.
dir Path to the folder from which the search is to be performed. If set to false, the search will start from the current folder.
Optional; false by default.

Examples of use

<?
// search for the file params.php up the folder hierarchy 
// starting from the current folder.
// if the file can be found, include it
include($_SERVER["DOCUMENT_ROOT"].$APPLICATION->GetFileRecursive("params.php"));
?>


© «Bitrix24», 2001-2022
Up