Home >Backend Development >PHP Tutorial >Typecho中的路由规则,用 | (或运算符) 做正则的定界符问题

Typecho中的路由规则,用 | (或运算符) 做正则的定界符问题

WBOY
WBOYOriginal
2016-06-06 20:36:291142browse

<code>array(6) {
 ["url"] => string(1) "/"
 ["widget"] => string(14) "Widget_Archive"
 ["action"] => string(6) "render"
 ["regx"] => string(8) "|^[/]?$|"
 ["format"] => string(1) "/"
 ["params"] => array(0) {
  }
}</code>

regx中的值是用|斜杠做定界符,不是用/或#吗?preg_match()函数

回复内容:

<code>array(6) {
 ["url"] => string(1) "/"
 ["widget"] => string(14) "Widget_Archive"
 ["action"] => string(6) "render"
 ["regx"] => string(8) "|^[/]?$|"
 ["format"] => string(1) "/"
 ["params"] => array(0) {
  }
}</code>

regx中的值是用|斜杠做定界符,不是用/或#吗?preg_match()函数

题目取的不好,自己看手册吧 http://php.net/manual/zh/regexp.reference.delimiters.php

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