Home  >  Article  >  Backend Development  >  php 正则有关问题

php 正则有关问题

WBOY
WBOYOriginal
2016-06-13 10:09:13867browse

php 正则问题
$url='http://www.scjj.gov.cn:8088/xxcx/jsp/searchAction!getDzjk.action';
用正则,取出
www.scjj.gov.cn:8088。。
怎么写。。

------解决方案--------------------

PHP code
$url='http://www.scjj.gov.cn:8088/xxcx/jsp/searchAction!getDzjk.action';preg_match_all( "/////(*?)///", $str, $tmp);var_dump($tmp);<br><font color="#e78608">------解决方案--------------------</font><br>
PHP code
preg_match("/\/\/(.*?)\//",$str,$tmp);var_dump($tmp);<br><font color="#e78608">------解决方案--------------------</font><br>
探讨
引用:
PHP code


preg_match("/\/\/(.*?)\//",$str,$tmp);
var_dump($tmp);

(.*?)怎么不会到www.scjj.gov.cn:8088/xxcx和www.scjj.gov.cn:8088/xxcx/jsp这个的?
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn