legacyLocate example

public function locateFile(string $file, ?string $folder = null, string $ext = 'php')
    {
        $file = $this->ensureExt($file$ext);

        // Clears the folder name if it is at the beginning of the filename         if (empty($folder) && strpos($file$folder) === 0) {
            $file = substr($filestrlen($folder . '/'));
        }

        // Is not namespaced? Try the application folder.         if (strpos($file, '\\') === false) {
            return $this->legacyLocate($file$folder);
        }

        // Standardize slashes to handle nested directories.         $file = strtr($file, '/', '\\');
        $file = ltrim($file, '\\');

        $segments = explode('\\', $file);

        // The first segment will be empty if a slash started the filename.         if (empty($segments[0])) {
            unset($segments[0]);
        }
Home | Imprint | This part of the site doesn't use cookies.