我有一个php模板,我试图使用Visual Studio 2015运行,但是当我运行项目时,我得到服务器错误505,并且在代码中有很多调用未知函数。我尝试运行其他PHP代码,他们工作正常。但是我不能运行这个模板。 get_header(),have_posts(),get_sidebar('right')都显示对未知函数的调用。此问题出现在具有所有功能的所有页面上。
<?php
get_header();
global $redux_demo;
?>
<section id="main" role="main">
<div class="container">
<div class="row">
<div class="col-sm-9 right-content">
<div class="row">
<?php if($redux_demo['ad1'] != '') {
echo '<div class="header_ad">' . $redux_demo['ad1'] . '</div>';
} ?>
<div class="col-sm-9">
<?php if($redux_demo['ad2'] != '') {
echo '<div class="header_ad">' . $redux_demo['ad2'] . '</div>';
} ?>
<div class="main-wrap">
<?php
if(isset($_GET['success']) && $_GET['success'] == '1') {
echo '<div class="alert alert-success">' . __("The post has been successfully added! If it's not visible, it might require approval from the site administrator!", 'Aruna') . '</div>';
}
if(isset($_GET['posterror']) && $_GET['posterror'] == '1') {
echo '<div class="alert alert-danger">' . __("The post couldn't be added, make sure you filled in all the required fields!", 'Aruna') . '</div>';
}
if(isset($_GET['register']) && $_GET['register'] == '1') {
echo '<div class="alert alert-success">' . __('Registration complete. Please check your e-mail for the password!', 'Aruna') . '</div>';
}
if(isset($_GET['register']) && $_GET['register'] == 'failed') {
echo '<div class="alert alert-danger">' . __('Registration failed! Make sure you filled all the fields and that they are correct.', 'Aruna') . '</div>';
}
if(isset($_GET['login']) && $_GET['login'] == 'failed') {
echo '<div class="alert alert-danger">' . __('Login failed! Make sure the username & password are correct!', 'Aruna') . '</div>';
}
if ( have_posts() ) :
$count = 1;
while ( have_posts() ) : the_post();
if($count == 3 && $redux_demo['ad3'] != '') {
echo '<div class="header_ad ad_between">' . $redux_demo['ad3'] . '</div>';
}
get_template_part( 'content', get_post_format() );
$count++;
endwhile;
get_template_part('includes/pagination');
endif;
?>
</div>
</div>
<?php get_sidebar('right');?>
</div>
</div>
<?php get_sidebar('left');?>
</div>
</div>
答案 0 :(得分:0)
首先,您的服务器实例不支持HTTP协议。您需要先解决这个问题。
不支持505 HTTP版
服务器不支持HTTP 请求中使用的协议版本。
其次,您是否包含了您在模板中调用的功能/方法?如果PHP编译器找不到主题,它将抛出 google.charts.load('current', {'packages':['corechart','sankey']});
google.charts.setOnLoadCallback(drawChart);
//console.log(gameAssets);
function drawChart() {
var sankeydata = new google.visualization.DataTable();
sankeydata.addColumn('string', 'From');
sankeydata.addColumn('string', 'To');
sankeydata.addColumn('number', "Number of Players");
sankeydata.addRows([
[ "Number of Players","Completions", 391 ],
["Completions","Successful Completions",160],
["Number of Players","Exit" ,768],
["Completions","Unsuccessful Completions",231]
]);
// Sets chart options.
var options = {
width: 970,
sankey: {
node: {
width: 4 ,
colors: ['#883b90'],
label: {
fontSize: 14
}
},
link: {
color: { fill: '#f4eee2' }
}
}
};
var sankey_chart = new google.visualization.Sankey(document.getElementById('sankey_basic'));
sankey_chart.draw(sankeydata, options)
}