我的文件夹包含大约500个文件(html)。 每个文件都包含此脚本
<script type="text/javascript"><!--
google_ad_client = "??????";
/* unit1 */
google_ad_slot = "??????";
google_ad_width = 120;
google_ad_height = 90;
//-->
</script>
我想用这个
替换上面的代码<script type="text/javascript" src="/wp-content/themes/twentyfourteen/open.js"></script>
我使用此代码&gt;&gt;很好
这只在php中查找并替换,但在html中找不到并替换。 任何人都可以在html文件中查找和替换它吗?
答案 0 :(得分:1)
替换此代码:
if( is_file( $path ) && substr($path, -3)=='php' && substr($path, -17) != 'ChangePHPText.php'){
使用:
if( is_file( $path ) && substr($path, -4)=='html' && substr($path, -17) != 'ChangePHPText.php'){
答案 1 :(得分:0)
这不是我们在这里做的,但我认为你只会改变第17行:
if( is_file( $path ) && substr($path, -3)=='php' && substr($path, -17) != 'ChangePHPText.php'){
到
if( is_file( $path ) && substr($path, -4)=='html' && substr($path, -17) != 'ChangePHPText.php'){
虽然老实说,如果你正在进行那么多的文本更改,你可能会发现一个文本编辑器可以更快地在文件中进行字符串替换。