Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> require i include
mat_1200
post
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 17.12.2005

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


Mam problem z funkcją require i include. Mam oto takie katalogi:

fragments

tables
_____________

w folderze 'tables' jest plik 'tables_news.php'

w folderze 'fragments' jest pelno plikow a jeden z nich to 'news.php'

W pliku 'tables_news.php' chce wstawić funkcję require tak by w nawiasie był plik 'news.php'

Próbowałem wpisać require'fragments/news.php'; ale nie dziala.
wyskoczył błąd:
Cytat
Warning: main(fragments/news.php): failed to open stream: No such file or directory in c:\usr\apache\httpd\html\www\site kod\php\tables\table_news.php on line 1

Fatal error: main(): Failed opening required 'fragments/news.php' (include_path='.') in c:\usr\apache\httpd\html\www\site kod\php\tables\table_news.php on line 1


Poradzcie coś...
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dr_bonzo
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

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


Manual: "The require() statement includes and evaluates the specific file."
"require() and include() are identical in every way except how they handle failure"

  1. <?php for ( $i = 0; $i < 3; $i ++ )
  2. {
  3. include 'a_' . $i . '.php';
  4. }?>


  1. <?php for ( $i = 0; $i < 3; $i ++ )
  2. {
  3. require 'a_' . $i . '.php';
  4. }?>


oczywiscie utworz pliki 'a_*.php' -- rezultat: wsyzstkie 3 zostaluy zaincludowane/zarequirowane.
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: 6.10.2025 - 15:43