亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我如何在 mod_rewrite 引擎的正則表達式中允許空間

我如何在 mod_rewrite 引擎的正則表達式中允許空間

PHP
慕沐林林 2023-07-08 16:42:01
我有一個正則表達式,我希望它允許空格。我使用的這個正則表達式位于 .htaccess 文件中。每當我放置它時,\s它都會使整個正則表達式不起作用我該怎么做才能讓它允許空白并工作?這是我的正則表達式:([a-zA-Z0-9_-]+)\/?$ RewriteRule ^(?!profile|home|recieved|search|ajaxsearch|sent|favorites|deletemessage|favorite|replypopup|deletereply|Editprofile|changepass|followingsystem|checkFollowers|block|report|logout|login|register|forgotpassword|resetpassword|twitterapi|index|manage)([a-zA-Z0-9_-]+)\/?$ ./searchusers.php?search=$1 [L]這是我的完整重寫規則,當我輸入 \s 時它不起作用
查看完整描述

1 回答

?
慕姐4208626

TA貢獻1852條經驗 獲得超7個贊

你的規則是這樣的:

RewriteRule ^(?!profile|home|recieved|search|ajaxsearch|sent|favorites|deletemessage|favorite|replypopup|deletereply|Editprofile|changepass|followingsystem|checkFollowers|block|report|logout|login|register|forgotpassword|resetpassword|twitterapi|index|manage)([^/]+)/?$ ./searchusers.php?search=$1 [L,QSA,NC]

[^/]是匹配除空格之外的任何字符的否定字符類/,它也將匹配空白。


查看完整回答
反對 回復 2023-07-08
  • 1 回答
  • 0 關注
  • 138 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號