PHP: "Footer function"?

Posted by Ricket on Stack Overflow See other posts from Stack Overflow or by Ricket
Published on 2010-05-18T20:34:09Z Indexed on 2010/05/18 20:40 UTC
Read the original article Hit count: 146

Filed under:

I have a project. It has a good number of PHP files. Each of these files includes a standard header. They don't include a standard footer.

Now I want to do something just before the end of every page. I can go through each page and add the footer code, but I was wondering if there is an easier way (and I think I've seen something like it before, though I might be mistaken).

Is there a way to set a "hook" or "trigger" function that will be executed at the end of a page, from the included header PHP script? I'm thinking of something like set_error_handler but to handle a page close event. Or like C's atexit function.

© Stack Overflow or respective owner

Related posts about php