我希望你能对我的问题有所了解。我需要一个AJAX/PHP/MYSQL应用程序来显示我正在写的页面上的帖子和内容。
我只是在吃了蘑菇之后才发现如何用PHP做一些简单的事情,但那是几年前的事了,现在我没有蘑菇,我只是卡住了!
问题是:
我想我需要通过php发送一个合适的“xml”文件,这样ajax部分可以接受它,但是:当我试图将头放在php的顶部时,它会显示以下错误:
“文档末尾的额外内容”
当我看到一些教程的时候,人们都很害怕地用“标题”来做我想做的事情,没有评论表明它不起作用。为什么它不能在我的本地服务器上工作?
我在跑:
黄蜂
阿帕奇2.2.11
它在远程服务器(PHP 5.3.0)上也不工作:/
谢谢您!
header('content-type: application/xhtml+xml; charset=utf-8');
require_once("allyouneed.php");
require_once("bazingablob.php");
$category=$_GET["category"];
$post_tags=$_GET["post_tags"];
$language=$_GET["language"];
$author=$_GET["author"];
$posts_per_page=$_GET["posts_per_page"];
$current_page=$_GET["current_page"];
$order=$_GET["order"];
$hard_limit=$_GET["hard_limit"];
$show_hidden=$_GET["show_hidden"];*/
$wypluj="";
$wypluj="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
$bazinga_blob = new bazingablob;
if (!$bazinga_blob->connect_to_database())
{
$wypluj.="0";
echo $wypluj;
exit;
}
else
{
$wypluj.="jedziem";
}
$bb_result=$bazinga_blob->get_all_posts($category,$post_tags,$language,$author,$posts_per_page,$current_page,$order,$hard_limit,$show_hidden);
if ($bb_result) //udalo sie cos znalezc w bazie wedlug kryteriow
{
$wypluj.="";
$wypluj.="";
$wypluj.=$bazinga_blob->posts_pagination["current_page"];
$wypluj.="";
$wypluj.="";
$wypluj.=$bazinga_blob->posts_pagination["last_page"];
$wypluj.="";
$wypluj.="";
$wypluj.=$bazinga_blob->posts_pagination["posts_count"];
$wypluj.="";
$wypluj.="";
$wypluj.="";
foreach ($bb_result as $item)
{
$wypluj.="";
$wypluj.="".$item->post_id."";
$wypluj.="".$item->post_author."";
$wypluj.="".$item->post_langid."";
$wypluj.="".$item->post_slug."";
$wypluj.="".$item->post_title."";
$wypluj.="".$item->post_greeting_picture."";
$wypluj.="".$item->post_greeting_video."";
$wypluj.="".$item->post_greeting_sound."";
$wypluj.="".$item->post_short."";
$wypluj.="".$item->post_body."";
$wypluj.="".$item->post_date."";
$wypluj.="".$item->post_published."";
$wypluj.="".$item->post_sticky."";
$wypluj.="".$item->post_comments."";
$wypluj.="".$item->post_protected."";
$wypluj.="";
}
$wypluj.="";
}
echo $wypluj;