从MySQL获取的数据无法在PHP输出_无法从PHP发送内容类型:text/xml header,同时从MYSQL获取数据...

我希望你能对我的问题有所了解。我需要一个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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值