Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] funkcja include
--Bart--
post
Post #1





Goście







Witam,

Chyba nie do końca jestem świadomy jak działa funkcja include() w PHP.

Mam strukturę katalogów:

/ WWW
index.php
WWW / KATALOG
1.php
2.php

W pliku 1.php jest instrukcja:
  1. <?php
  2. include('2.php');
  3. ?>


A w pliku index.php jest instrukcja:
  1. <?php
  2. include('1.php');
  3. ?>


I najdziwniejsze jest to ze to rozwiazanie DZIALA !

Czy nie powinno byc tak ze w pliku 1.php musi byc:
  1. <?php
  2. include('KATALOG/2.php');
  3. ?>


co zreszta tez DZIALA !

Dzieki za odpowiedz.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
--Bart--
post
Post #2





Goście







Dziekuje za odpowiedz.

No i wszystko sie wyjasnilo - nie wiem czemu umknelo mi to podczas czytania manuala.

Jakby ktos mial jeszcze watpliwosci:

Files for including are first looked for in each include_path entry relative to the current working directory, and then in the directory of current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/. If filename begins with ./ or ../, it is looked only in the current working directory. " title="Zobacz w manualu PHP" target="_manual

Pozdrawiam
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: 16.10.2025 - 04:48