问题描述
我想知道是否有一种方法可以指定每次用户访问和退出我网站上的页面时要调用的php函数或文件.因此,如果有用户访问,例如example.com/ex.php,我可以在ex.php运行之前和ex.php完成之后调用一个函数吗?
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?
我希望能够记录在我的网站上执行php文件并存储所需的时间,以便以后可以运行查询来分析信息.我希望不必在要跟踪的每个文件的开头和结尾添加代码.
I want to be able to record the 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.
谢谢.
推荐答案
尝试自动添加/添加文件ini指令.
Try auto Append/prepend file ini directive.
http://php.net/manual/en/ini.core.php
这篇关于在每个请求之前和之后运行的PHP函数或文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!