他のサイトからコンテンツを取得するファイルがあります。それはたくさんのクルードです:
<script>
[random] string 1
</script>
<script>
[random] string 2
</script>
....
<script>
[random] string n
</script>
<script type="text/javascript">
must keeping script
</script>
<script type=text/javascript'>
must keeping script
</script>
<script>
削除したいのです</script>
が、PHPを使用してそれらの間に「[ランダム]文字列...」のコンテンツを保持します。
注:str_replaceはそれらを削除できますが、他のスクリプト<script type="text/javascript">must keeping</script>
やを傷つける可能性があり<script type='text/javascript'>must keeping</script>
ます。</script>
スクリプトを保持する必要のあるクローズタグが失われます
助けてくれてありがとう
//解決済み:
$content = preg_replace('/(<script>)(.*?)(<\/script>)/s', '$2', $content);
とにかく、助けてくれてありがとう