php - 字符串类型的 XML 变量问题 PHP
问题描述
请查看以下代码
$xml_string = "<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Body>
<res:ResultMsg xmlns:res='http://cps.huawei.com/cpsinterface/result'>
<![CDATA[
<?xml version='1.0' encoding='utf-8'?><Result><ResultParameters><ResultParameter><Key>FailedReason</Key><Value>The value 611015125123 of the CNIC parameter is incorrect, failed to authenticate the parameter.</Value></ResultParameter></ResultParameters><ResultCode>2002</ResultCode><ResultType>0</ResultType><OriginatorConversationID>20180904165750</OriginatorConversationID><ResultDesc>Transaction information is invalid.</ResultDesc><TransactionID>000000000000</TransactionID><ConversationID>AG_20180904_00007be9004e56992e5f</ConversationID></Result>]]>
</res:ResultMsg>
</soapenv:Body>
</soapenv:Envelope>";
然后我得到变量的类型
$type=gettype($xml_string);
echo 字符串好。当我尝试回显实际值时,它只是打印出其中的一部分。
FailedReasonThe value 611015125123 of the CNIC parameter is incorrect, failed to authenticate the parameter.2002020180904165750Transaction information is invalid.000000000000AG_20180904_00007be9004e56992e5f]]>
为什么会发生这种奇怪的行为。我也尝试替换所有换行符,但没有帮助。任何提示表示赞赏。
解决方案
我最后犯了一个愚蠢的错误,如果有人偶然发现这个问题,请回答。根据对我问题的评论,我有完整的数据,但由于标签,浏览器没有显示它。
echo "<textarea>";
echo $manual ;
echo "</textarea>";
做了这项工作。
推荐阅读
- java - 是否可以使用 setWeightSum(float) 以编程方式更改 weightSum 值?
- python - 函数调整图像大小:(-215:断言失败)!ssize.empty()在函数“resize”中
- c# - 如何根据 CheckBox 值(MVVM)过滤集合
- java - JNI:从 C++ 设置 jobjectArray
- javascript - React Native - 为什么我的条件 If/If Else 语句永远不会通过?
- javascript - 经典 ASP 查询字符串变量已设置和未设置
- oracle - 无法从 Glassfish 池连接到外部 Oracle 数据库,但我可以从 DBeaver
- python - Django Order By on Reverse Foreign Key value 删除没有关系的项目
- python - 如何将数据从屏幕存储到屏幕?
- firefox - Spring Fox (Swagger-UI) 2.9.2 如何禁用“试用”按钮