不推荐使用 eregi() 函数。我怎样才能替换eregi()。我尝试使用 preg_match 但然后停止工作。
我使用 ethis 帮助:
http://takien.com/513/how-to-fix-function-eregi-is-deprecated-in-php-5-3-0.php
之前的代码:
if ( ! eregi("convert$", $this->library_path))
{
if ( ! eregi("/$", $this->library_path)) $this->library_path .= "/";
$this->library_path .= 'convert';
}
if (eregi("gd2$", $protocol))
{
$protocol = 'image_process_gd';
}
代码然后:
if ( ! preg_match("convert$/i", $this->library_path))
{
if ( ! preg_match("/$/i", $this->library_path)) $this->library_path .= "/";
$this->library_path .= 'convert';
}
if (preg_match("gd2$/i", $protocol))
{
$protocol = 'image_process_gd';
}