<?php
header("Content-type:text/html;charset=utf-8");
$str = '<script type="text/javascript" src=""></script>
Test php regular match js code test php regular match js code test php regular match js code test php regular match js code test php regular match js code test php regular match js code test php regular match js code test php regular match js code
<script type="text/javascript" src=""></script>
<script type="text/javascript">
var aa = "sdsds";
alert(aa);
</script>
Test php regular match to drop js code';
$preg = "/<script[\s\S]*?<\/script>/i";
$newstr = preg_replace($preg,"",$str,3); //The 3 in the fourth parameter represents 3 replacements, the default is -1, replace all
echo $newstr;
?>