Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 apache2 服务器,它有一个庞大且不断增长的文件夹结构。
我想在该网站的每个页面的开头执行一组指令。
我如何实现它而不只是在网站中每个文件的开头粘贴这些行?
顺便说一句,我有 apache 服务器。
您可以使用说明编写一个 shell 脚本,并在所有页面顶部使用 php shell exec 函数执行它,以便在加载时执行 shell 脚本。或任何其他语言您需要的任何其他功能。
您可以通过在 php.ini 中设置 'auto_prepend_file' 和 'auto_append_file' 指令来做到这一点。