織夢
<code>{<span>dede:</span>geturl runphp=<span>'yes'</span>} <span>$url</span> = <span>$_SERVER</span>[<span>'HTTP_HOST'</span>]; preg_match(<span>"#[\w-]+\.(com|net|org|gov|cc|biz|info|cn|co)(\.(cn|hk|uk))*#"</span>, <span>$url</span>, <span>$match</span>); <span>@me</span> = <span>$match</span>[<span>0</span>]; {<span>/dede:geturl}</span></code>
PHP
<code><span><span><?php</span><span>$url</span> = <span>$_SERVER</span>[<span>'HTTP_HOST'</span>]; preg_match(<span>"#[\w-]+\.(com|net|org|gov|cc|biz|info|cn|co)(\.(cn|hk|uk))*#"</span>, <span>$url</span>, <span>$match</span>); <span>echo</span><span>$match</span>[<span>0</span>]; <span>?></span></span></code>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介紹了PHP和織夢正則preg_match獲取頂級域名,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。