0

我在修复这个旧的 PHP eregi funxtion 时遇到问题,因为它使用 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

4

1 回答 1

1

这是我做这项工作的方式:

$sMotif = "/--$sIN ([a-zA-Z0-9]{3,4},)*([a-zA-Z0-9]{3,4}) ?/";
if ( preg_match($sMotif,$this->sParam)) {
于 2015-04-29T17:30:37.547 回答