Jelix\Core\Config\Compiler::findServerName PHP Метод

findServerName() публичный статический Метод

public static findServerName ( $ext = '.php', $isCli = false )
    public static function findServerName($ext = '.php', $isCli = false)
    {
        $varname = '';
        $extlen = strlen($ext);
        if (strrpos($_SERVER['SCRIPT_NAME'], $ext) === strlen($_SERVER['SCRIPT_NAME']) - $extlen || $isCli) {
            return 'SCRIPT_NAME';
        } else {
            if (isset($_SERVER['REDIRECT_URL']) && strrpos($_SERVER['REDIRECT_URL'], $ext) === strlen($_SERVER['REDIRECT_URL']) - $extlen) {
                return 'REDIRECT_URL';
            } else {
                if (isset($_SERVER['ORIG_SCRIPT_NAME']) && strrpos($_SERVER['ORIG_SCRIPT_NAME'], $ext) === strlen($_SERVER['ORIG_SCRIPT_NAME']) - $extlen) {
                    return 'ORIG_SCRIPT_NAME';
                }
            }
        }
        throw new Exception('Error in main configuration on URL engine parameters -- In config file the parameter urlengine:scriptNameServerVariable is empty and Jelix doesn\'t find
            the variable in $_SERVER which contains the script name. You must see phpinfo and setup this parameter in your config file.', 11);
    }

Usage Example

Пример #1
0
 public static function findServerName($ext = '.php', $isCli = false)
 {
     return \Jelix\Core\Config\Compiler::findServerName($ext, $isCli);
 }