Hi all,
I would like to know that how to check whether a file has been successfully included into current file.
4 Replies - 732 Views - Last Post: 14 June 2011 - 04:45 AM
#1
how to check whether a file has been included in to current file
Posted 14 June 2011 - 02:44 AM
Replies To: how to check whether a file has been included in to current file
#2
Re: how to check whether a file has been included in to current file
Posted 14 June 2011 - 02:50 AM
use require. that emits an error if the inclusion failed. or test with file_exists() and/or is_readable() whether it is possible to include the file.
#3
Re: how to check whether a file has been included in to current file
Posted 14 June 2011 - 02:57 AM
Dormilich, on 14 June 2011 - 02:50 AM, said:
use require. that emits an error if the inclusion failed. or test with file_exists() and/or is_readable() whether it is possible to include the file.
Thank you for your quick reply. I am using the below piece of code where the file by name Mail.php is being included.
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
include "header.php";
include "Mail/Mail.php";
if(is_readable('Mail/mail.php'))
echo "file exists.";
else
echo "not exists."; ?>
Here ini_set() and error_reporting() has been used to display errors if any. The above code is not producing any results neither the error or warning messages. Even I tried using require instead of include but not able to get any error message and getting only blank page.
This post has been edited by jagadish_c: 14 June 2011 - 03:08 AM
#4
Re: how to check whether a file has been included in to current file
Posted 14 June 2011 - 04:03 AM
depends on what header.php & mail.php do. e.g. if you do a redirect, you won’t see anything that you print.
#5
Re: how to check whether a file has been included in to current file
Posted 14 June 2011 - 04:45 AM
Dormilich, on 14 June 2011 - 04:03 AM, said:
depends on what header.php & mail.php do. e.g. if you do a redirect, you won’t see anything that you print.
Thank you Dormilich. The problem was with inclusion of 'header.php' which is doing the redirect. Now the error messages can be seen after removing the header.php. Thanks again.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|