已弃用 ereg 的问题

发布于 2024-09-09 12:10:14 字数 275 浏览 2 评论 0原文

有人可以帮我重写这些代码吗:

if (eregi($asked,$accepted)) {
 $this->plot_type = $which_pt;
 return true;
} else {
 $this->DrawError('$which_pt not an acceptable plot type');
 return false;
}

任何帮助将不胜感激,我已经尝试了通过谷歌获得的所有修复,但没有一个能够修复它。

谢谢。

Can some please help me to rewrite these code:

if (eregi($asked,$accepted)) {
 $this->plot_type = $which_pt;
 return true;
} else {
 $this->DrawError('$which_pt not an acceptable plot type');
 return false;
}

Any help will be highly appreciated, I have tried all the fix I got through Google but none has been able to fix it.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心凉怎暖 2024-09-16 12:10:17
if ( preg_match($asked."i",$accepted) ) // there is no case insensitive version of preg_match
{
    $this->plot_type = $which_pt;
    return true;
} else {
    $this->DrawError("$which_pt not an acceptable plot type"); // i think you want " instead of ' here
    return false;
}

应该这样做。如果没有,请与我们分享$asked中正则表达式的内容。

if ( preg_match($asked."i",$accepted) ) // there is no case insensitive version of preg_match
{
    $this->plot_type = $which_pt;
    return true;
} else {
    $this->DrawError("$which_pt not an acceptable plot type"); // i think you want " instead of ' here
    return false;
}

should do it. If it doesn't, please share with us the content of the regular expression in $asked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文