Home  >  Article  >  Backend Development  >  关于正则表达式的匹配有关问题

关于正则表达式的匹配有关问题

WBOY
WBOYOriginal
2016-06-13 13:19:54887browse

关于正则表达式的匹配问题

如何做到,如果图中连接的文件是repair.php?id=108。。。仍然能匹配成功呢?

------解决方案--------------------
首先说URL的组成:
schema://username@password:host/path?query_string#fragment

如果楼主的需求只是匹配path部分, 并且不关心后面的query_string和fragment, 那么不需要正则:

PHP code

$now_page    = substr($now_page, 0, strpos($now_page, '?'));
switch ( $now_page ) {
    # ... 原有的逻辑
} <div class="clear">
                 
              
              
        
            </div>
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