I'm new to PHP and trying to get a handle on some basics.
require() and include() both load up a file. require() exits if the
inclusion fails while include() issues a warning and the script
continues. In the latter situation how should I detect the failure?
include('Foo.ph p');
if (...) {
Foo::do_somethi ng();
} else {
backup_action() ;
}
What should the test be? Can I catch the warning thrown by the
include()? Should I search through get_included_fi les()? The
file being included is a "standard" one which might be missing from an
installation, so I can't edit it to define a constant in it.
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pete.forman@wes terngeco.com -./\.- opinion of Schlumberger, Baker
http://petef.port5.com -./\.- Hughes or their divisions.
require() and include() both load up a file. require() exits if the
inclusion fails while include() issues a warning and the script
continues. In the latter situation how should I detect the failure?
include('Foo.ph p');
if (...) {
Foo::do_somethi ng();
} else {
backup_action() ;
}
What should the test be? Can I catch the warning thrown by the
include()? Should I search through get_included_fi les()? The
file being included is a "standard" one which might be missing from an
installation, so I can't edit it to define a constant in it.
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pete.forman@wes terngeco.com -./\.- opinion of Schlumberger, Baker
http://petef.port5.com -./\.- Hughes or their divisions.
Comment