This is a discussion on including a file if it exists within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hello, I am just wondering if there is a standard php function that includes a file if it is exists, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello,
I am just wondering if there is a standard php function that includes a file if it is exists, or something else that avoids error messages when the file doesn't exist. It is quite easy to write a function to reach this (I actually did) but I couldn't find any standard function although it might be available. Martien |
|
|||
|
Martien van Wanrooij wrote:
> Hello, > > I am just wondering if there is a standard php function that includes a file > if it is exists, or something else that avoids error messages when the file > doesn't exist. It is quite easy to write a function to reach this (I > actually did) but I couldn't find any standard function although it might be > available. > @include "file.txt"; -- Oli |
|
|||
|
"Martien van Wanrooij" <info_removethis_@martienvanwanrooij.nl> kirjoitti
viestissä:cIf1e.5614$Mw3.1005@amstwist00... > > "Oli Filth" <catch@olifilth.co.uk> schreef in bericht > news:Wdf1e.226$AZ6.152@newsfe3-win.ntli.net... >> @include "file.txt"; > Thank you _very_ much, obviously I am not very good at Google-ing but this > is really helpful :) > In case you were eondering what it does: the @-sign before a command suppresses possible error and warning messages. |
|
|||
|
"Kimmo Laine" <eternal.erectionN0.5P@Mgmail.com> schreef in bericht news:d24309$m51$1@phys-news1.kolumbus.fi... > In case you were eondering what it does: the @-sign before a command > suppresses possible error and warning messages. Yes I found it out now, but I never had noticed that option, thanx :) |
|
|||
|
Martien van Wanrooij a écrit:
> Hello, > > I am just wondering if there is a standard php function that includes a > file > if it is exists, or something else that avoids error messages when the > file doesn't exist. It is quite easy to write a function to reach this (I > actually did) but I couldn't find any standard function although it might > be available. > > Martien if file_exists("path/to/file.inc"){ include("path/to/file.inc") } -- __________________________________________________ __________ / Le nombre partage, organise le monde. Fernand Braudel, Les \ \ structures du quotidien / ------------------------------------------------------------ \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || |