簡體   English   中英

提交時的正則表達式問題

[英]Regex problems while submitting

提交新聞時,我的網站有問題。 一切正常,並且新聞已提交,但我收到此錯誤消息。

Warning: preg_replace(): Unknown modifier '/' in C:\xampp\htdocs\submit_articles.php on line 121

這是我編輯過的代碼(我剛剛添加了[^ \\ w \\ d] / si',),但是正則表達式對我來說還是未知的。

$NewImageName = preg_replace(array('[^\w\d]/si','\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), strtolower($PostTitle));

嘗試:

$NewImageName = preg_replace(array('/[^\w\d]/si','/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), strtolower($PostTitle));

preg中的正則表達式必須用/ ... /括起來,修飾符放在后面的/之后。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM