开发者

PHP function or file to run before and after every request

开发者 https://www.devze.com 2022-12-14 17:17 出处:网络
I am wondering if there is a way to specify a php function or file to be called every time a user visits and exits a page on my site. So if a user visits say example.com/ex.php can I have a function c

I am wondering if there is a way to specify a php function or file to be called every time a user visits and exits a page on my site. So if a user visits say example.com/ex.php can I have a function called before ex.php is run and after ex.php is finished?

I want to be able to record 开发者_如何学Gothe time it takes to execute php files on my site and store that so I can run queries later to analyze the info. I would prefer not to have to add code to the beginning and end of every file I want to track.

Thanks in advance.


Try auto Append/prepend file ini directive.

http://php.net/manual/en/ini.core.php


Apache can log the time taken to serve a request directly. This includes more than just the PHP but may be better depending on your needs.

See mod_log_config docs

0

精彩评论

暂无评论...
验证码 换一张
取 消