hello guys .
Can someone tell me how to create a function in php that works whenever someone opens a page that does not exist and at the same time the code notifies me with the error . I have created one but it does not work for all pages . Please tell me how to do it

Recommended Answers

All 3 Replies

You can do this by htaccess file also.
below is the code when user open non existed file then he is redirected to error.php.

ErrorDocument 404 http://localhost/project/error.php

hello guys .
Can someone tell me how to create a function in php that works whenever someone opens a page that does not exist and at the same time the code notifies me with the error . I have created one but it does not work for all pages . Please tell me how to do it

Hey, have you try $_SERVER, It may be give you the error code or page which currently access by you

Hope this will help you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.