【发布时间】:2015-02-27 19:00:50
【问题描述】:
我刚刚为我的 wordpress 博客创建了无限循环,它在我的本地 PC(WAMP)上运行良好,但是当我把它放到网上(nginx 服务器)它显示 POST http://www.siteurl.com/infinite-loop.php 500 Internal Server Error
无限循环.php
<?php
$infinite_loop= $_POST['pcount']; ?>
<?php require_once("/wp-blog-header.php"); ?>
<div class="x-container-fluid max width main">
<div class="offset cf">
<div class="<?php x_main_content_class(); ?>" role="main">
<?php
global $wpdb;
$args = array( 'posts_per_page' => 10, 'order' => 'DESC', 'offset'=>$infinite_loop );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div>
<div style="width:300px; float:left;">
<?php x_ethos_featured_index(); ?>
</div>
<div style="width:500px; float:right;">
<?php /* print $args['offset']; */ ?>
<?php x_get_view( 'ethos', '_content', 'post-header' ); ?>
<?php x_get_view( 'global', '_content' ); ?>
<?php
</div>
</div>
</article>
<?php endforeach;
wp_reset_postdata(); ?>
</div> <?php get_sidebar(); ?>
</div></div>
主题标题中的 AJAX
<script>
$(document).ready(function() {
var post_page_count = 10;
var height_scroll = 400;
$(window).scroll(function() {
if ($('body').height() <= ($(window).height() + $(window).scrollTop())){
post_page_count = post_page_count+10;
$.ajax({
type: "POST",
async: false,
url: "theme/infinite_loop.php",
data: {pcount:post_page_count},
success:
function(result){
$("#gizinfi").append(result);
}
});
};
});
});
</script>
我不知道是什么问题。它在带有 WAMP 的本地 PC 上运行良好,但在在线服务器上显示错误。任何人都可以请帮助我知道问题是什么?请帮忙...
【问题讨论】:
-
通过设置error_reporting(E_ALL)检查你得到了什么错误; ini_set("display_errors", 1);
标签: php ajax wordpress nginx infinite-loop