这很有用!
preg_match_all('/<script[^>]+src=([\'"])?((?(1).+?|[^\s>]+))(?(1)\1)/', '<script src="brosta/brostapp/assets/global/plugins/bootstrap-datepaginator/bootstrap-datepaginator.min.js" type="text/javascript"></script>', $matches);
print_r ($matches);
但这不是。有什么帮助吗?
$scripts='<script src="brosta/brostapp/assets/global/plugins/bootstrap-datepaginator/bootstrap-datepaginator.min.js" type="text/javascript"></script>|<script src="{$public}/brosta/brostapp/assets/global/plugins/bootstrap-confirmation/bootstrap-confirmation.min.js" type="text/javascript"></script>|<script src="{$public}/brosta/brostapp/assets/global/plugins/bootstrap-confirmation/dffde/bootstrap-confsssirmation.min.js" type="text/javascript"></script>';
$scripts=explode("|", $scripts);
for($i=0;$i<count($scripts);$i++) {
preg_match_all('/<script[^>]+src=([\'"])?((?(1).+?|[^\s>]+))(?(1)\1)/', $scripts[$i], $matches);
print_r($matches);
}