Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Błąd przy wczytaniu i includowaniu
Zawiej
post
Post #1





Grupa: Zarejestrowani
Postów: 15
Pomógł: 0
Dołączył: 13.08.2008

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


Witam dziś zacząłem pisać skrypt w z którego wczytuje katalog thema z plikami tekstowymi tz:
otwiera plik patch.php wczytuje z niego folder thema standardowa default
następnie jest to dodawane do ścieżki i includowane...
a wiec co robie źle?
CODE

<?php

$plik = fopen("admin/patch.php","r");

$czytaj = fread($plik,100);

$them = "themes/$czytaj/index.php";
include($them);

fclose($plik);

?>

błedy na localhost wyskakują takie:

CODE
Warning: include(themes/default /index.php) [function.include]: failed to open stream: No such file or directory in /var/www/public_html/mzCMS/index.php on line 8



Warning: include() [function.include]: Failed opening 'themes/default /index.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/public_html/mzCMS/index.php on line 8



To tak jak by po default dodawało spacje.
Pozdro

Ten post edytował Zawiej 15.09.2008, 13:45:22
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
webdice
post
Post #2


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Prawdopodobnie czyta Ci z pliku tekst ze znakiem nowej linii na końcu. Dodaj sobie:

  1. <?php
  2. $czytaj = str_replace ("r\n", "", fread($plik,100));
  3. ?>


EDIT: Nie wiem czy forum coś psuje, czy tak Ci wyświetla. Jeśli w/w przykład nie pomoże spróbuj jeszcze z trim" title="Zobacz w manualu PHP" target="_manual.
Go to the top of the page
+Quote Post
mike
post
Post #3





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Kod
Warning: include(themes/default /index.php)

Masz niepotrzebną spację w adresie "themes/default /index.php".
Go to the top of the page
+Quote Post
Zawiej
post
Post #4





Grupa: Zarejestrowani
Postów: 15
Pomógł: 0
Dołączył: 13.08.2008

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


CODE

<?php
$uchwyt = "admin/patch.php";
$plik = fopen($uchwyt,"r");
$czytaj = str_replace ("\r\n", "", fread($plik,7));

$them = "theme/$czytaj/index.php";
include($them);
?>

zmieniłem i czyta działa tylko jest taki problem ;/ plik thema musi mieć 7 liter

Ten post edytował Zawiej 15.09.2008, 14:49:04
Go to the top of the page
+Quote Post

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: 18.09.2025 - 17:26