PHP FixPath Function [ceļa apdares amats]
FixPath Amats: noteikt netīriem ceļiem. PHP ceļu apdares funkciju.
Piemērs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <? Php ; echo "nnn Dirty ceļus: n"; = 'C://////////Windows//////System' ; // C:/System $ Ceļus [] = 'C :////////// Windows ////// System ", / / C: / System = 'C:HTMLjavascript..examplescolors.html' ; // C:/HTML/examples/colors.html $ Ceļus [] = 'C: HTMLjavascript .. examplescolors.html'; / / C: / HTML / piemēri / colors.html = '/root/./wwwroot/scripts/../././webpage' ; // /root/wwwroot/webpage $ Ceļus [] = '/ root /. / Wwwroot / skriptus / .. /. /. / Webpage'; / / / root / wwwroot / webpage = 'wwwroot/webpage/../index.php?querystring' ; // wwwroot/index.php?querystring $ Ceļus [] = 'wwwroot / webpage / .. / index.php? Querystring'; / / wwwroot / index.php? Querystring = 'http://www.php.net/manual/en/../../downloads' ; // http://www.php.net/downloads $ Ceļus [] = 'http://www.php.net/manual/en/../../downloads'; / / http://www.php.net/downloads = 'http://www.php.net/downloads/test/test1/test2//./docs.php' ; // http://www.php.net/docs.php $ Ceļus [] = 'http://www.php.net/downloads/test/test1/test2//./docs.php'; / / http://www.php.net/docs.php = '../downloads/../docs.php' ; // ../docs.php $ Ceļus [] = '.. / downloads / .. / docs.php'; / / .. / docs.php = 'localhost//projetos/../_arquivos/../' ; // "" $ Ceļus [] = 'localhost / / projetos / .. / _arquivos /../'; / / "" = 'C:/downloads/../../../' ; // C:/ $ Ceļus [] = 'C: / downloads /../../../'; / / C: / = 'downloads/../../../' ; // ../../ $ Ceļus [] = 'downloads /../../../'; / / ../../ $paths as $path ) foreach ($ ceļus kā $ ceļā) ( . $path . "" = "" . fixpath ( $path ) . """ ; echo "n" "." $ ceļš. "" = "". fixpath ($ ceļu). "" "; ) ?> |
Piezīme: "/ /" vēl viens slashes būs roll atpakaļ root.











































