Fungsi PHP FixPath [path finishing fungsi]
FixPath Fungsi: memperbaiki jalan kotor. PHP jalur finishing fungsi.
Contoh:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <? Php ; echo "nnn Dirty path: n"; = 'C://////////Windows//////System' ; // C:/System $ Path [] = 'C :////////// Windows ////// Sistem'; / / C: / Sistem = 'C:HTMLjavascript..examplescolors.html' ; // C:/HTML/examples/colors.html $ Path [] = 'C: HTMLjavascript .. examplescolors.html'; / / C: / HTML / contoh / colors.html = '/root/./wwwroot/scripts/../././webpage' ; // /root/wwwroot/webpage $ Path [] = '/ root /. / Wwwroot / scripts / .. /. /. / Halaman web'; / / / Root / wwwroot / webpage = 'wwwroot/webpage/../index.php?querystring' ; // wwwroot/index.php?querystring $ Path [] = 'wwwroot / webpage / .. / index.php? Querystring'; / / wwwroot / index.php? Querystring = 'http://www.php.net/manual/en/../../downloads' ; // http://www.php.net/downloads $ Path [] = '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 $ Path [] = 'http://www.php.net/downloads/test/test1/test2//./docs.php'; / / http://www.php.net/docs.php = '../downloads/../docs.php' ; // ../docs.php $ Path [] = '.. / download / .. / docs.php'; / / .. / docs.php = 'localhost//projetos/../_arquivos/../' ; // "" $ Path [] = 'localhost / / projetos / .. / _arquivos /../'; / / "" = 'C:/downloads/../../../' ; // C:/ $ Path [] = 'C: / download /../../../'; / / C: / = 'downloads/../../../' ; // ../../ $ Path [] = 'Download /../../../'; / / ../../ $paths as $path ) foreach ($ path sebagai jalur $) ( . $path . "" = "" . fixpath ( $path ) . """ ; echo "n" ". $ path." "=" ". fixpath ($ path)." ""; ) ?> |
Catatan: "/ /" satu lagi slashes roll akan kembali root.











































