相关疑难解决方法(0)

如何将数组转换为SimpleXML

如何在PHP中将数组转换为SimpleXML对象?

php xml arrays simplexml

277
推荐指数
10
解决办法
39万
查看次数

如何在Zend Framework应用程序中返回XML

我在ZF应用程序中返回XML时遇到问题.我的代码:

class ProjectsController extends Gid_Controller_Action
{
    public function xmlAction ()
    {
        $content = "<?xml version='1.0'><foo>bar</foo>";
        header('Content-Type: text/xml');
        echo $content;
    }
}
Run Code Online (Sandbox Code Playgroud)

我也尝试过以下方法:

class ProjectsController extends Gid_Controller_Action
{
    public function xmlAction ()
    {
        $content = "<?xml version='1.0'><foo>bar</foo>";
        $this->getResponse()->clearHeaders();
        $this->getResponse()->setheader('Content-Type', 'text/xml');
        $this->getResponse()->setBody($content);
        $this->getResponse()->sendResponse();
    }
}
Run Code Online (Sandbox Code Playgroud)

有人能指出我正确的方向如何实现这一目标?

xml zend-framework return response

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

xml ×2

arrays ×1

php ×1

response ×1

return ×1

simplexml ×1

zend-framework ×1