Yii开发微信时如何接受Post请求 解析Xml

微信给yii发来的文件是xml格式


<xml>

 <ToUserName><![CDATA[toUser]]></ToUserName>

 <FromUserName><![CDATA[fromUser]]></FromUserName> 

 <CreateTime>1348831860</CreateTime>

 <MsgType><![CDATA[text]]></MsgType>

 <Content><![CDATA[this is a test]]></Content>

 <MsgId>1234567890123456</MsgId>

 </xml>

微信类是用这样方式获取数据的


public function getRev()

{

if ($this->_receive) return $this;

$postStr = file_get_contents("php://input");

$this->log($postStr);

if (!empty($postStr)) {

$this->_receive = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);

}

return $this;

}



我想问一下在yii要如设置才能实现上述功能,在控制器中设置还是在模型中设置。

关健是这个语句我的设置中获取不到值

$postStr = file_get_contents("php://input");

请帮助这个放在什么位置能获取微信post 过来的xml内容