我有一个包含 49 个文件夹的项目,每个文件夹都有一个名为 index.php 的文件
所有 index.php 文件几乎相同,除了一部分会根据其所在的文件夹而变化。
<?php include_once("/home/bgarch/public_html/galleryheader.html"); ?>
<?php include_once("/home/bgarch/public_html/culture/loadscripts.html"); ?>
</head>
<body>
<div class="header">
<?php include_once("/home/bgarch/public_html/header.html"); ?>
</div>
<div class="clear"></div>
<div class="displaywrapper">
<?php include_once("content.html"); ?>
</div></div>
<div class="clear"></div>
<?php include_once("/home/bgarch/public_html/footer.html"); ?>
在上面写着:“../culture/..”的第二行中,文化一词是变量,并且根据它所在的文件夹而有所不同。
我需要知道的是执行“在项目中查找/替换所有内容”,它会自动将每个“index.php”文件中的所有文本替换为以下内容“
<?php include_once("http://www.bgarchitect.co.nz/subPage/index.php"); ?>
在过去的 2 个小时里,我一直在试图找出正则表达式来实现这一点,但到目前为止还没有成功。也许不可能这样做?
无论如何,我想我会在这里问一个问题,希望它实际上比我预期的要容易得多。因此,非常感谢任何帮助/指针/提示或技巧。
感谢阅读,詹尼斯