当我通过preg_replace反馈得到$ url变量时,它不起作用但是我用它所使用的注释行指定了$ url值。我的代码有什么问题吗?非常感谢。
$content = preg_replace('/(plugin_[^ ]+)/', getPlugin('$1'), $content);
function getPlugin($plugin) {
$url = "http://".$_SERVER['HTTP_HOST']."/{$plugin}.php?language=en";
//$url = "http://".$_SERVER['HTTP_HOST']."/plugin_contact.php?language=en";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}