3', PHPWEB:'Chinesische PHP-Website', settings:'Einstellungen', FullScreen:'Ganzer Bildschirm', Speed:'Geschwindigkeit', BrainwashingLoop:'Schleife', speedNormal:'Normal', click_to_see:'Klicken Sie hier, um den vollständigen Code für die direkte Bearbeitung anzuzeigen', nextSection:'nächsten Abschnitt', Cancel:'Stornieren', Confirm:'Bestätigen', all_lang_string:'zh|en|zh-tw|ja|ko|ms|fr|de', Next:'Nächste', Previous:'Vorherige', };
php 用正则处理 字符窜的截取
比如有下面一个例子:
$string="{dede:pagestyle maxwidth='600' pagepicnum='12' ddmaxwidth='200' row='3' col='4' value='2'/}
{dede:img ddimg=' /uploads/allimg/120804/488-120P40U014.jpg ' text='鸟瞰图' width='709' height='749'} /uploads/allimg/120804/488-120P40U014.jpg {/dede:img}
{dede:img ddimg='/uploads/allimg/120804/488-120P40U213.jpg' text='酒店鸟瞰图' width='567' height='399'} /uploads/allimg/120804/488-120P40U213.jpg {/dede:img}
{dede:img ddimg='/uploads/allimg/120804/488-120P40U228.jpg' text='商业沿街效果图' width='1476' height='629'} /uploads/allimg/120804/488-120P40U228.jpg {/dede:img}
{dede:img ddimg='/uploads/allimg/120804/488-120P40U238.jpg' text='效果图' width='567' height='450'} /uploads/allimg/120804/488-120P40U238.jpg {/dede:img}
{dede:img ddimg='/uploads/allimg/120804/488-120P40U243.jpg' text='沿街效果图' width='567' height='354'} /uploads/allimg/120804/488-120P40U243.jpg {/dede:img}";
通过处理循环输出:ddimg,text两个属性
输出结果: /uploads/allimg/120804/488-120P40U014.jpg 鸟瞰图
/uploads/allimg/120804/488-120P40U213.jpg 酒店鸟瞰图
/uploads/allimg/120804/488-120P40U228.jpg 商业沿街效果图
/uploads/allimg/120804/488-120P40U238.jpg 效果图
/uploads/allimg/120804/488-120P40U243.jpg' 沿街效果图
同时计算出图片的张数。。
大家帮帮忙 谢谢
------解决方案--------------------
preg_replace("/ddimg='([^\']*)'\s+text='([^\']*)'/e",'$arr["$1"]="$2"',$string);print_r($arr);<br><font color="#e78608">------解决方案--------------------</font><br>$ar=array_slice($arr,0,4);<br>print_r($ar);<br>echo count($ar);<div class="clear"> </div>