<script>1111</script>2222<script>3333</script>777<script>6666</script>我想得到<script>1111</script><script>3333</script><script>6666</script>等多个脚本
最后也得到111 3333 6666脚本里面的值一般是路径
谢谢!
最后也得到111 3333 6666脚本里面的值一般是路径
谢谢!
$str = "<script>1111 </script>2222 <script>3333 </script>777 <script>6666 </script>";$pattern = "/<script>(\S*)\s*<\/script>/";preg_match_all($pattern, $str, $matchs);print_r($matchs[1]);
?>可以满足现在的需求,但有一个缺点就是,1111 3333 6666这样的字符串中不能有空格,否则在最后的结果中就会缺少该结果不知道还有没么有更好的方法
<?php
$str = "<script>111 1 </script>2222 <script>33 33 </script>777 <script>6666 </script>";$pattern = "/\<script>[\n\r]*(.*?)[\n\r]*<\/script>/";preg_match_all($pattern, $str, $matchs);print_r($matchs[1]);
?>