.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test1.png);
background-repeat: repeat-x;
}
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test2.png);
background-repeat: repeat-x;
}
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test3.png);
background-repeat: repeat-x;
}我想获取到这个值
{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test2.png);
background-repeat: repeat-x;
}大概匹配规则就是:{ + 一堆字符串 + test2.png + 一堆字符串 + }怎么匹配,有些急
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test1.png);
background-repeat: repeat-x;
}
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test2.png);
background-repeat: repeat-x;
}
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test3.png);
background-repeat: repeat-x;
}我想获取到这个值
{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test2.png);
background-repeat: repeat-x;
}大概匹配规则就是:{ + 一堆字符串 + test2.png + 一堆字符串 + }怎么匹配,有些急
解决方案 »
- php 小偷程序 求解!
- extends和implements有什么区别??
- 变量在input中输出时,空格后的值不能显示?为什么 ?
- 如何当钩选checkbox的时候,能够从数据库中自动产生 select small_areaid的 option 列表
- 哪里有下载php 源代码的 网站
- swfupload 偶尔502问题
- 开发中大型网站是选用sql server2000还是mysql更为合适?
- 如何动态添加Form项里的文本框
- mysql数据库区分大小怎么解决?
- 数组的简单问题,那位帮忙解决一下,最简单地实现才给分
- php怎么验证是否是邮箱?邮箱怎么写$t['????']这里来验证?
- 访客计数器问题
$str = <<<STR
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test1.png);
background-repeat: repeat-x;
}
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test2.png);
background-repeat: repeat-x;
}
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test3.png);
background-repeat: repeat-x;
}
STR;
$patten = '/({[^{]+test2.png[^{]*})/i';
preg_match_all($patten,$str,$arr);
echo "<pre>";
print_r($arr[1]);
$str = <<<STR
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test1.png);
background-repeat: repeat-x;
}
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test2.png);
background-repeat: repeat-x;
}
.body{
align: center;
font-size: 10pt;
background: #CCCDDC;
background-image: url(http://localhost/images/test3.png);
background-repeat: repeat-x;
}
STR;
preg_match_all('/\{.*test2\.png.*\}/isU', $str, $matches);
print_r($matches[0]);
/**
输出结果:Array ( [0] => { align: center; font-size: 10pt; background: #CCCDDC; background-image: url(http://localhost/images/test1.png); background-repeat: repeat-x; } .body{ align: center; font-size: 10pt; background: #CCCDDC; background-image: url(http://localhost/images/test2.png); background-repeat: repeat-x; } )
*/