Toon posts:

[php] include/require fail

Pagina: 1
Acties:
  • 145 views

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Is het eigenlijk mogelijk dat een include of require fails?

Als het bestand op de server aanwezig is en bij testen werkt kan dit dan failen?
Moet ik hiervoor een soort van foutafhandeling voorzien?

Acties:
  • 0 Henk 'm!

  • Creepy
  • Registratie: Juni 2001
  • Laatst online: 21-09 21:47

Creepy

Tactical Espionage Splatterer

Heb je de PHP docs er al op nageslagen?
http://nl2.php.net/include/

The documentation below also applies to require(). The two constructs are identical in every way except how they handle failure. They both produce a Warning, but require() results in a Fatal Error. In other words, use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well. Be warned that parse error in included file doesn't cause processing halting in PHP versions prior to PHP 4.3.5. Since this version, it does.
Dus ja, een include of require kan falen. Dit kan zijn omdat het bestand niet bestaat of omdat de rechten niet goed staan en PHP de file net kan lezen.

Wil je aub in het vervolg zelf its meer vooronderzoek doen? Het is hier geen afhaalbalie voor al je vragen ;)

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


Dit topic is gesloten.