php - 为什么我在使用 PHP 生成的 XML 文件中出现错误
问题描述
我正在使用 php 从一组值创建一个 xml 文件。在函数 saveXml() 之前一切正常。当我打开 xml 时,我发现每 16384 个字符出现一些错误
我的代码:
$db_results = $this->getValues(array('1','2','3'));
if( @count($db_results) > 0 ){
$XML = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><dati></dati>');
$XML->addAttribute('tipologia', '_tipologia1');
foreach($db_results as $key => $val){
$blocco_1 = $XML->addChild('blocco1');
$blocco_1->addAttribute('blocco1_id',$val['id']);
$blocco_2 = $blocco_1->addChild('info_blocco2');
$blocco_2->addChild('id',$val['id_td']);
}
if(file_exists($this->_export_dir . 'output.xml')) unlink($this->_export_dir . 'output.xml');
$XML->saveXML($this->_export_dir . 'output.xml');
}
我无法将错误粘贴到 xml 中。您可以在下面的图片中看到 OUTPUT XML
我尝试增加服务器内存限制,但问题仍然存在。
欢迎任何建议
解决方案
推荐阅读
- python - 当我尝试在 Windows 上运行 flask db init 时出现迁移错误
- python - 仅打印 .txt 文件中的特定单词 - Python
- c# - 创建计算数字 T 平均值的通用类
- jquery - 使用 jQuery + HTML 进行网站搜索
- linux-kernel - 如何实现带阻塞的字符设备?
- python - 检查熊猫数据框的最后一行是否满足条件的最佳方法是什么?
- reactjs - 如何从对回调 URL 的响应中提取数据?
- azure-functions - 使用 CLI 创建 Azure Function 项目
- typescript - 谷歌地图没有显示 Javascript Ionic 4
- ssl - 获取剩余有效期的 SSL 证书的证书错误