我想更換一個詞來一些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