我想更换一个词来一些PHP代码
$filecontent = [regex]::Replace($filecontent, $myword, $phpcode)
但是$ phpcode也纷纷采用了特殊的变量$ _一些PHP代码
<?php $cur_author = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
问题是,当代码在$ filecontent中替换它将替换$ _变量从php代码($ _GET)与它在管道中的位置。
这不会发生其他变量,如$ author_name。
我该如何解决这个问题?
这就是解决方案,简单的OMG,谢谢 – Pedro3M