替换旧的 eregi 函数 PHP
Replace old eregi function PHP
我在修复这个旧的 PHP eregi 函数时遇到问题,因为它使用了 IN 参数。
这是来自 Matthieu MARY
的验证码生成脚本 class_log.php
旧代码:
$sMotif = "--$sIN ([a-zA-Z0-9]{3,4},)*([a-zA-Z0-9]{3,4}){1}";
if ((eregi("$sMotif ",$this->sParam))||(eregi("$sMotif$",$this->sParam))){
$this->aParam['bExtension'] = TRUE;
$this->aParam['aExtension'] = $this->_PARAM_get_extension($sIN);
$this->aParam['inExtension'] = ($sIN=='e');
$this->aParam['iParameters']++;
}
我试试这个,但不确定它是否正确?
$sMotif = "/--$sIN ([a-zA-Z0-9]{3,4},)*([a-zA-Z0-9]{3,4}){1}/i";
if ((preg_match("$sMotif ",$this->sParam))||(eregi("$sMotif$",$this->sParam))){
$this->aParam['bExtension'] = TRUE;
$this->aParam['aExtension'] = $this->_PARAM_get_extension($sIN);
$this->aParam['inExtension'] = ($sIN=='e');
$this->aParam['iParameters']++;
}
tnx
这是我完成这项工作的方式:
$sMotif = "/--$sIN ([a-zA-Z0-9]{3,4},)*([a-zA-Z0-9]{3,4}) ?/";
if ( preg_match($sMotif,$this->sParam)) {
我在修复这个旧的 PHP eregi 函数时遇到问题,因为它使用了 IN 参数。 这是来自 Matthieu MARY
的验证码生成脚本 class_log.php旧代码:
$sMotif = "--$sIN ([a-zA-Z0-9]{3,4},)*([a-zA-Z0-9]{3,4}){1}";
if ((eregi("$sMotif ",$this->sParam))||(eregi("$sMotif$",$this->sParam))){
$this->aParam['bExtension'] = TRUE;
$this->aParam['aExtension'] = $this->_PARAM_get_extension($sIN);
$this->aParam['inExtension'] = ($sIN=='e');
$this->aParam['iParameters']++;
}
我试试这个,但不确定它是否正确?
$sMotif = "/--$sIN ([a-zA-Z0-9]{3,4},)*([a-zA-Z0-9]{3,4}){1}/i";
if ((preg_match("$sMotif ",$this->sParam))||(eregi("$sMotif$",$this->sParam))){
$this->aParam['bExtension'] = TRUE;
$this->aParam['aExtension'] = $this->_PARAM_get_extension($sIN);
$this->aParam['inExtension'] = ($sIN=='e');
$this->aParam['iParameters']++;
}
tnx
这是我完成这项工作的方式:
$sMotif = "/--$sIN ([a-zA-Z0-9]{3,4},)*([a-zA-Z0-9]{3,4}) ?/";
if ( preg_match($sMotif,$this->sParam)) {