<span> 跳至 [1] </span> [全屏预览] <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush: php; auto-links: false; "><?php $str="<img src='1.jpg' style="max-width:90%" height='200px' / alt="创建一个对网页中图片进行匹配的正则表达式" >"; $pattern="/^<img \s+src=.*?\/ alt="创建一个对网页中图片进行匹配的正则表达式" >$/i"; if(preg_match($pattern, $str)){ echo "网页图片格式正确"; }else{ echo "网页图片格式错误"; } ?></pre><div class="contentsignin">登入後複製</div></div> <style type="text/css"> .code_report{float:right} .code_report div{ float: left; margin-left: 5px; background: url("/img/ask-icon.gif") no-repeat; padding: 6px 0 6px 15px; padding-left: 15px; height: 16px;} .code_report a{ background: url("/img/ask-icon.gif") 0 -160px no-repeat;padding-left: 20px; line-height: 15px;height: 16px; color: #333; text-decoration: none; display:inline-block; zoom:1; vertical-align: middle;} .code_report em{ height: 28px; line-height:28px; width: 14px; display: inline-block; float: left; background: url("/img/ask-icon.gif") top right;} </style>