Reference

Guide

$file->root()

Returns the absolute root to the file

$file->root(): string|null

Return type

string|null

Example

if($file = $page->file()):
    echo $file->root();
    // i.e. /var/www/yourdomain.com/html/content/some-page/some-file.jpg
endif;

Source code

kirby/src/Cms/File.php#L597