sen*_*ale 5 php regex preg-match eregi
函数eregi()已弃用.我怎样才能取代eregi().我尝试使用preg_match然后停止工作.
我们帮助他们:
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';
}
Run Code Online (Sandbox Code Playgroud)
代码然后:
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';
}
Run Code Online (Sandbox Code Playgroud)
preg_match 期望它的正则表达式参数在一对分隔符内.
所以尝试:
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';
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11065 次 |
| 最近记录: |