21,887
社区成员
发帖
与我相关
我的任务
分享
global $url_path;
$url_path='abc.com';
$html = preg_replace_callback("/(<a[^<]*\s+href\s*=\s*[\'\"])([^<]*)([\'\"])/is", "fun1", $html);
function fun1($matches)
{
return $matches[1] . $url_path(这里$url_path为何是空值?);
}
function fun1($matches)
{
global $url_path;
return $matches[1] . $url_path;//(这里$url_path为何是空值?);
}
global $url_path;
$url_path='abc.com';
$html = "<a href='/bbc/'>asdf</a>";
$html = preg_replace_callback("/(<a[^<]*\s+href\s*=\s*)[\'\"]([^<]*)[\'\"]/is", "fun1", $html);
function fun1($matches)
{
global $url_path;
return $matches[1] . $url_path;
}
echo $html;
function fun1($matches)
{
global $url_path;
return $matches[1] . $url_path(这里$url_path为何是空值?);
}
$url_path='abc.com';
$html = preg_replace_callback("/(<a[^<]*\s+href\s*=\s*[\'\"])([^<]*)([\'\"])/is", "fun1", $html);