Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]PHP nie widzi pierwszych znaków, Coś zmalowałem
Johnas
post
Post #1





Grupa: Zarejestrowani
Postów: 650
Pomógł: 16
Dołączył: 5.07.2010
Skąd: Ściśle Tajne

Ostrzeżenie: (0%)
-----


Witam, mam problem... mianowicie nie wiem nawet gdzie go szukać... PHP ignoruje mi pierwsze znaki...


  1. $dir = dirname(__FILE__);
  2. $rootPath = realpath('./global');
  3. $zip = new ZipArchive;
  4. $zip->open('update-'.$version.'.zip', ZipArchive::CREATE | ZipArchive::EXCL);
  5.  
  6. $files = new RecursiveIteratorIterator(
  7. new RecursiveDirectoryIterator($rootPath),
  8. RecursiveIteratorIterator::LEAVES_ONLY
  9. );
  10.  
  11. foreach ($files as $name => $file) {
  12. $file_in_zip = str_replace($dir."\\", "", $file)."<br>";
  13. if (!$file->isDir())
  14. {
  15. // Get real and relative path for current file
  16. $filePath = $file->getRealPath();
  17. $relativePath = substr($filePath, strlen($rootPath) + 1);
  18. $path_in_zip = str_replace($dir."\\", "", $filePath);
  19. // Add current file to archive
  20. if (strpos($relativePath, "nstall\\") or strpos($relativePath, "ake-update.php") or strpos($relativePath, "old\\") or strpos($relativePath, "zepsuty") or strpos($relativePath, "lobal\config.php") or strpos($relativePath, "vs\\") or strpos($relativePath, "git\\") or strpos($relativePath, "idea\\") or strpos($relativePath, "pload\\") or strpos($relativePath, "cache\\") or strpos($relativePath, 'ploads\\') or strpos($relativePath, "emplates_c")) {
  21. echo "Ignoruje ".$relativePath."</br>";
  22. } else {
  23. echo "Dodano plik: ".$relativePath."</br>";
  24. $zip->addFile($filePath, $path_in_zip, true);
  25. }
  26. }
  27. }
  28.  
  29. $zip->close();


mam taki kod.. i wszystko dobrze by było gdyby nie to że muszę użyć
  1. strpos($relativePath, "nstall\\")
"nstall" zamiast install, a wszystkie skompresowane pliki nie mają pierwszego znaku... Wie ktoś może co jest przyczyną tego błędu ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 27.09.2025 - 11:17