gpt4 book ai didi

php - 编译失败 : nothing to repeat at offset 6

转载 作者:可可西里 更新时间:2023-11-01 00:35:42 27 4
gpt4 key购买 nike

我不确定为什么这行不通......在多个 regex 检查器和测试器中完美运行。但是当涉及到在 PHP 中运行它时,我得到了这个错误:

Warning: `preg_match()` [function.preg-match]: 
Compilation failed: nothing to repeat at offset 6 in /home/splose/public_html/index/index.php on line 49

我正在运行这个:

if(preg_match('[\\/^$.|?*+():<>]', $username)){}

最佳答案

也许你可以尝试划定你的模式?:

if(preg_match('/[\\/^$.|?*+():<>]/', $username)){}

直接取自PHP Docs :

Often used delimiters are forward slashes (/), hash signs (#) and tildes (~).

关于php - 编译失败 : nothing to repeat at offset 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8454564/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com