我有点绝望了,我不是一个很有经验的PHP开发人员,现在我在自己的工作中遇到了一个我无法解决的问题。
我有30或40个网站,在30或40个域名(每个国家一个网站)
所有的网站使用完全相同的代码(相同)
然而,我的一个网站没有显示。它只是没有加载,没有错误,它只是没有加载。我已经工作了一整天,我相信这是由于一个功能,但我看不出它的问题。
头文件调用配置文件@
<? include('config.php'); ?>
配置文件调用函数文件
include('functions.php');
和找出可能是哪个函数的问题,我从底部开始,并删除他们一个一个刷新页面每次。最后,我得到了一个函数,一旦删除,我的页面加载,但显然与其他错误由于缺少函数。
我认为有问题的函数是:
function get_contenttitle($SectionID,$languageid){
global $languageid;
global $mysql_connect;
if($languageid==''){$languageid=$_SESSION["SelectLanguage"];}
$query='SELECT * FROM website.content WHERE SortOrder="'.$SectionID.'" AND LanguageID="'.$languageid.'" AND Active=1 AND LanguageID IN (1, 2, 3, 4, 5, 6, 8, 11, 12, 14, 15, 16, 30)';
//$content=dbqueryintoarray($query);
$content=db_query_into_array_enhanced($mysql_connect,$query);
if(count($content)>0){
$return=$content[0]["ContentTitle"];
}else{
if($languageid==''){$languageid=$_SESSION["SelectLanguage"];}
$query='SELECT * FROM website.content_auto WHERE SortOrder="'.$SectionID.'" AND LanguageID="'.$languageid.'" AND Active=1 AND LanguageID IN (1, 2, 3, 4, 5, 6, 8, 11, 12, 14, 15, 16, 30)';
//$content=dbqueryintoarray($query);
$content=db_query_into_array_enhanced($mysql_connect,$query);
if(count($content)>0){
$return=$content[0]["ContentTitle"];
}else{
$query='SELECT * FROM website.content WHERE SortOrder="'.$SectionID.'" AND LanguageID="1" AND Active=1';
//$content=dbqueryintoarray($query);
$content=db_query_into_array_enhanced($mysql_connect,$query);
if(count($content)>0){
$return=$content[0]["ContentTitle"];
}else{
$return='<b><font color="#FF0000">Warning:</font></b> Content does not exist';
}
}
}
$return=str_replace(chr(10),'<br>',$return);
return $return;
}
现在这个函数在顶部导航中被调用。如果我删除了这个函数,页面就会加载到它被调用的导航栏,然后显然就会停止。当我把函数放回去的时候,页面就完全停止加载了。
这个函数使用了一个db_query_into_array_enhanced函数,如下所示:
function db_query_into_array_enhanced($mysql_connect,$query){
global $mysql_debug_comments;
global $total_query_count;
global $total_query_time;
global $total_function_time;
global $log_to_firephp;
global $query_results_to_firephp;
global $output_stats_to_browser;
global $firephp;
global $slow_query_time;
global $query_time;
$bt=debug_backtrace();
$file=$bt[1]["file"];
$pos=strrpos($file,'/');
$calling_script=substr($file,($pos+1));
$calling_line=$bt[1]["line"];
settype($retval,"array");
$query_start=getmicrotime();
$result=mysqli_query($mysql_connect,$query);
$query_end=getmicrotime();
$query_time=($query_end-$query_start);
$total_query_time=$total_query_time+$query_time;
$query_time_ms=round($query_time*1000);
if(!$result){$mysql_debug_comments.="<!-- db_query_into_array_enhanced | Called By: ".$calling_script." | Line: ".$calling_line." | Query FAILED ".$query." -->'n'n";}
if($result){
$success=true;
$function_start=getmicrotime();
$row_count=mysqli_num_rows($result);
for($x=0;$x<$row_count;$x++){$row=mysqli_fetch_array($result,MYSQLI_ASSOC);array_push($retval,$row);}
mysqli_free_result($result_set);
$function_end=getmicrotime();
$function_time=($function_end-$function_start);
$total_function_time=$total_function_time+$function_time;
$mysql_debug_comments.="<!-- Function: db_query_into_array_enhanced | Called By: ".$calling_script." | Line: ".$calling_line." | Status: OK | Results: ".count($retval)." rows | Query Time: ".$query_time_ms."ms | Total Time: ".round($total_query_time*1000)." ms ";
if($query_time_ms>$slow_query_time){$mysql_debug_comments.=" | Query: ".$query." ";}
$mysql_debug_comments.="-->'n'n";
$total_query_count++;
}
if($log_to_firephp==true){
$query_time_ms=round($query_time*1000);
$function_time_ms=round($function_time*1000);
$total_time=$query_time+$function_time;
$query_perc=round(($query_time/$total_time)*100,2);
$function_perc=round(($function_time/$total_time)*100,2);
$log_type='info';
if($success==true){
$message1='db_query_into_array_enhanced | Query: "'.$query.'"';
$message2='db_query_into_array_enhanced | Rows: '.count($retval).' | MySQL Time: '.$query_time_ms.'ms ('.$query_perc.'%) | Function Time: '.$function_time_ms.'ms ('.$function_perc.'%) | Total Time: '.($query_time_ms+$function_time_ms).'ms';
if(($query_time>0.5) or ($function_time>0.5) or ($query_time+$function_time>0.5)){$log_type='warn';}
}else{
$message1='db_query_into_array_enhanced | Query: "'.$query.'" | QUERY FAILED!';
$log_type='error';
}
if($log_type=='info'){$firephp->info($message1);$firephp->info($message2);}
if($log_type=='warn'){$firephp->warn($message1);$firephp->warn($message2);}
if($log_type=='error'){$firephp->error($message1);}
}
if($query_results_to_firephp==true){
$headings=array_keys($retval[0]);
$table=array();
$table[]=$headings;
for($r=0;$r<count($retval);$r++){
$row=array();
for($c=0;$c<count($retval[0]);$c++){array_push($row,$retval[$r][$headings[$c]]);}
$table[]=$row;
}
$firephp->table('Results from MySQL Query "'.$query.'" Rows: '.count($retval).' Time: '.($query_end-$query_start).'s', $table);
}
if($output_stats_to_browser==true){
echo 'Query: '.$query.'<br>';
echo 'Query Time: '.$query_time_ms.'ms ('.$query_perc.'%)<br>';
echo 'Function Time: '.$function_time_ms.'ms ('.$function_perc.'%)<br>';
echo 'Total Time: '.($query_time_ms+$function_time_ms).'ms<br>';
echo 'Rows returned: '.count($retval).'<br>';
}
return $retval;
}
我将每一段代码与其他工作站点进行了对比,一切都是一样的。完全一样。
我都快疯了,谁来帮帮我吧
感谢
我的猜测是,函数"get_contenttitle"正在寻找数据从数据库它没有连接到。我也没有看到另一个函数"db_query_into_array_enhanced"中的连接。是否有连接到数据库的功能?如果有的话,看看这个。