0
我交換了一個幾年前的程序,並更新了PHP和MySQL的deprication,並且在preg_match
與ereg
之間的語法上出現堵塞。我嘗試在各處放置斜槓,並且無法提供正確的語法。我錯過了什麼?Preg_match上的語法
舊線:
if (!$this->config_allow_src_above_docroot
&& !ereg('^'.preg_quote(str_replace($this->osslash, '/', realpath($this->config_document_root))), $AbsoluteFilename))
{
新線:
if (!$this->config_allow_src_above_docroot
&& !preg_match('^'.preg_quote(str_replace($this->osslash, '/', realpath($this->config_document_root))), $AbsoluteFilename))
{
請原諒我福利局的煩躁,我需要逃脫 '/'?
如果這不起作用呢?如果(!$ this-> config_allow_src_above_docroot &&!preg_match(〜'^'。preg_quote(str_replace($ this-> osslash,'/',realpath($ this-> config_document_root)))〜,$ AbsoluteFilename)){using a波浪?我得到PHP解析錯誤:語法錯誤,意外')' – SL0WLearner
@ SL0WLearner分隔符是正則表達式字符串的一部分,您不能在字符串外添加字符。 – jeroen
還告訴我,我有太多的人。如果(!$ this-> config_allow_src_above_docroot &&!preg_match('〜^'。preg_quote(str_replace($ this-> osslash,'/',realpath($ this-> config_document_root)))。'〜',$ AbsoluteFilename)) { – SL0WLearner