Results 1 to 2 of 2

Thread: include a page and if doesn't found then 'exit;'

  1. #1

    Thread Starter
    Addicted Member mfurqan's Avatar
    Join Date
    Oct 2005
    Location
    Pakistan
    Posts
    176

    include a page and if doesn't found then 'exit;'

    I want to Include a page form URL like http://www.domain.com/abc.php and if doesn't found then 'exit;'
    Muhammad Furqan Attari.

  2. #2
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    Re: include a page and if doesn't found then 'exit;'

    If you want the program to just stop running, use require() instead of include... otherwise..,
    PHP Code:
        if(!include('somefile.html')) {
            exit(
    "error!");
        } 
    It returns false if the include failed. You might need to stick a @ in front as well to surpress an Warnings that might be displayed. (can't get error reporting working properly on my mac :\)
    Don't Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width