phpÕýÔòȡǶÌ×html±êÇ©
<?php
$s = <<<html
<html>
<head>
<title>nested tag test</title>
<mce:script type="text/javascript"><!--
alert('fdsafdasfasd');
// --></mce:script>
</head>
<body>
<div id=0>
<div id=1><img name="img1" id="img1" src=""/>
<div id=2><img name="img2" id="img2" src=""/>
<div id=3><img name="img3" id="img3" src=""/>
</div>
</div>
</div>
</div>
</body>
</html>
html;
$pattern = "/(".
"<\!\w+(?:\s+[^>]*?)+\s*>|".
"<\w+(?:\s+\w+(?:\s*=\s*(?:\"[^\"]*\"|'[^']*'|[^\"'>\s]+))?)*\s*\/?>|".
"<\/\w+\s*>|".
"<\!--[^-]*-->".
")/";
preg_match_all($pattern, $s, $aMatches, PREG_OFFSET_CAPTURE);
function getMatchTags($s, $arr) {
$sMatchClose = '';
$arrClose = array();
$arrReturn = array();
for($i=0; $i<count($arr); $i++) {
$iCount = 0;
if (preg_match("/<[^>\s*]*/", $arr[$i][0], $aMatchOpen)) {
$sMatchClose = '</' . substr($aMatchOpen[0], 1) . '>';
for($j=$i-1; $j<count($arr); $j++) {
if (!(stripos($arr[$j][0], $aMatchOpen[0]) === false)) {
$iCount ++;
$flag = 1;
}
if (!(stripos($arr[$j][0], $sMatchClose) === false)) {
$iCount --;
$flag = 1;
if($iCount == 0 && $flag == 1) {
$arrClose[] = $arr[$i];
$arrClose[] = $arr[$j];
}
}
}
}
}
$k=0;
for($i=0; $i<count($arrClose); $i+=2) {
$arrReturn[$k][0] = $arrClose[$i];
$arrReturn[$k][1] = $arrClose[$i+1];
Ïà¹ØÎĵµ£º
(1) autoload»úÖÆ¸ÅÊö
ÔÚʹÓÃPHPµÄOOģʽ¿ª·¢ÏµÍ³Ê±£¬Í¨³£´ó¼Òϰ¹ßÉϽ«Ã¿¸öÀàµÄʵÏÖ¶¼´æ·ÅÔÚÒ»¸öµ¥¶ÀµÄÎļþÀÕâÑù»áºÜÈÝÒ×ʵÏÖ¶ÔÀà½øÐи´Óã¬Í¬Ê±½«À´Î¬»¤Ê±Ò²ºÜ±ãÀû¡£ÕâÒ²ÊÇOOÉè¼ÆµÄ»ù±¾Ë¼ÏëÖ®Ò»¡£ÔÚPHP5֮ǰ£¬Èç¹ûÐèҪʹÓÃÒ»¸öÀֻ࣬ÐèÒªÖ±½ÓʹÓÃinclude/require½«Æä°üº¬½øÀ´¼´¿É¡£ÏÂÃæÊÇÒ»¸öʵ¼ÊµÄÀý×Ó£º
CODE:
/* ......
µ¼¶Á£º ¡¡
¡¡Apache: ¡¡
¡¡¿ªÆô httpd.conf£¬¼ÓÈëÒÔÏÂÁ½ÐÐ: ¡¡
¡¡QUOTE: ¡¡
¡¡ServerTokens ProductOnly ¡¡
¡¡ServerSignature Off ¡¡
¡¡PHP: ¡¡
¡¡Òþ²Ø PHP °æ±¾¾ÍÊÇÒþ²Ø "X-Powered-By: PHP/5.1.2-1+b1" Õâ¸ö£¬¿ªÆô php.ini£¬¼ÓÈë: ¡¡
¡¡QUOTE: ¡¡
¡¡expose_php = Off ¡¡
¡¡Apache ½ûֹĿ¼ä¯ÀÀ: ¡¡
¡¡½ûֹĿ ......
*/
-->
Author:
Thinkhy
Date:
2010.04.11.
Url:
http://www.disandu.com/?p=714
Keyword:
HTML¿ÕÔªËØ DIV XSLT jQuery
½ñÌìÓиöHTML¿ÕÔªËØµÄÎÊÌâÕÛÌÚÁËÎÒÁ½¸öСʱ£¬ÎÊÌâÊÇÕâÑùµÄ£¬ÎÒÒª´¦ÀíÒ»¶ÎÃèÊö½á¹¹»¯Îı¾µÄHTMLƬ¶Ï£º
£¼div class='paper'>
£¼div class='questio ......
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {
Message.InnerHtml = "Welcome to ASP.NET";
}
</script>
...
<span id="Message" style="font-size:24" runat="server"/> ......