日期:2014-05-17  浏览次数:20410 次

PHP正则小问题
Array
(
[description] => HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=40EA513DEFAE87D378EACB79C4E8A1B5; Path=/ipcam
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 27 Jun 2013 01:08:23 GMT
Server: Apache-Coyote/1.1

c1b
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.liveipc.com/UserService/">
<SOAP-ENV:Body>
<ns1:UserOperationResponse>
<WSResponse>
<Version>1.0</Version>
<CharSet>GBK</CharSet>
<TransactionName>UserLogin</TransactionName>
<Random>244ab25cf7f0258401c2ae0b038ead0a</Random>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
0
}

这是原字符串,我想取出其中的xml那段字符串,要肿么来写那个正则,自己写的总是为空,整不出来。

结果应该为:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.liveipc.com/UserService/">
<SOAP-ENV:Body>
<ns1:UserOperationResponse>
<WSResponse>
<Version>1.0</Version>
<CharSet>GBK</CharSet>
<TransactionName>UserLogin</TransactionName>
<Random>244ab25cf7f0258401c2ae0b038ead0a</Random>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



------解决方案--------------------
那你是怎么写的?
------解决方案--------------------
关键是后面的ius不区分大小写多行匹配模式