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

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

WBOY
Release: 2016-06-13 10:37:28
Original
714 people have browsed it

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

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

------解决方案--------------------
首先说URL的组成:
schema:[email protected]: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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template