简体   繁体   English

如何从目录执行一组php文件

[英]how to execute a set of php files from a directory

The issue is like this....... 问题是这样的.......

I have Joomla and WordPress installed on one site and I have a set of PHP files, lets say.... 我在一个站点上安装了Joomla和WordPress,并且说有一组PHP文件。

file1.php file2.php file3.php and so on.... file1.php file2.php file3.php等等...

which are saved in a particular folder lets sat FOLDER-1. 将其保存在特定的文件夹中后,可以使用FOLDER-1。 These files have some scripts which get data from Joomla or WordPress. 这些文件具有一些脚本,这些脚本可从Joomla或WordPress获取数据。

I want to call a refresh option in my template parameters where we ask the user if he wants to refresh the files, If he chooses yes then I want that all PHP files in this FOLDER-1 must run once and perform their respective PHP actions. 我想在模板参数中调用一个刷新选项,询问用户是否要刷新文件。如果他选择“是”,那么我希望此FOLDER-1中的所有PHP文件必须运行一次并执行各自的PHP操作。

foreach (glob("*.php") as $filename) {
    include($filename);
}

Adjust glob argument to use whatever directory you want to search for .php files in. 调整glob参数以使用要在其中搜索.php文件的任何目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM