我正在使用Salesforce元数据API。我正在提供一个base64数据,其中包含一个项目清单,一个名为package.xml
的文件。如何从此数据中获取package.xml
文件。
请参阅以下编码数据:
UEsDBBQACAAIAOcycUEAAAAAAAAAAAAAAAAhAAAAdW5wYWNrYWdlZC9vYmplY3RzL0NvbnRhY3Qub2JqZWN01Vffb9owEH7nr4jyPpxO0zRNIRWlVKDxS5CNR2SSC/FwHGo7tPnv65CAE0CoUFYxnnKfz+fvvrtLjH3/GlFjDVyQmDXMu7plGsC82Cds0TB/u09ffpj3Ts1uJULG0XD+FzxpqC1MNMxQytVPhESMV3URxNyDuhdH6KtlfUfWNxSBxD6W2HRqhvrZwPCcwhOALxzJE7BRGcl9AgJ0a+RAQukAR+D0MFskeAFiNvNstIO1J7xK4AzTru8EmIosvEa0G8VzoDqajXKg5ABsIUPnzrLUWv6sFzk8J4TD7oidrV0kx94yy6lDlGQ83boe4KUt6QocV9FVXtmjXkkYeU5gG6KwcqlQWatTwgH2J3GiqnNUthXxllQx0lAF/oNpAqK6WI0/hfmxwDtHHwKcULnNYWtWj0OnzjuDzCiMGRhdllUlvSFamEsG3BhDAJxjekPMVGOEWIBv9JT/7fAayhD4v6YjYi71LBdW7XDz/qiOCrw8rmfM4xrodV5iWaTDF9iHJ3oCXsx8fEsD5AKX5KYYjTiJPoHQJS164QfoHV29oUng5WhjNyltxUxiT4qjvR0Qqlp54sUqeFvdOFIZqktGdoLG91tcxTR00FKnK6PK5TS3B8Jl6ONUuCERfRUwvALFHN2v2EYwpzUcuM2WW3/ojt3OY9NtF0ruOauAHEt19XLURUKVyUYaqXqus+5w3E53Muur2B0b5UipFw74FCLukjey7I0i/cvF7KfvrnOfMDhd4X56lQIP4KWHhZwCLD+psq1xW5X1cXa94vaaE3c2bbd/nVFblbeRJW7kmX9IwKw7/msBN9NxgYCbsTgtoI3K/4Cc2htQSwcIRtMK5HUCAAA4DQAAUEsDBBQACAAIAOcycUEAAAAAAAAAAAAAAAAWAAAAdW5wYWNrYWdlZC9wYWNrYWdlLnhtbE2OzQrCMBCE732KkLvZWKSIpOmh4FUP+gBpumrVJKVZRd/e2h90TzPDx+yo4uXu7IldbILP+VJIztDbUDf+nPPjYbtY80Inam/szZyR9bSPOb8QtRuAGEwr4il0FoUNDlIpM5ArcEimNmS4Tlh/it4txlEP3qGr+pe6DJ6MJQVz8EO8cajLR6TgdtUVv9AQjYXw16im9TrNhFQwu0TBNFonH1BLBwj45N4QogAAAOYAAABQSwECFAAUAAgACADnMnFBRtMK5HUCAAA4DQAAIQAAAAAAAAAAAAAAAAAAAAAAdW5wYWNrYWdlZC9vYmplY3RzL0NvbnRhY3Qub2JqZWN0UEsBAhQAFAAIAAgA5zJxQfjk3hCiAAAA5gAAABYAAAAAAAAAAAAAAAAAxAIAAHVucGFja2FnZWQvcGFja2FnZS54bWxQSwUGAAAAAAIAAgCTAAAAqgMAAAAA
我正在使用base64_decode()方法,但我得到如下输出:
PKç2qA!unpackaged/objects/Contact.objectÕWßoÚ0~篈ò>œNÓ4M!¥T ñKGd’ñpj;´ùïë€@¨PV1žrŸÏçï¾»KŒ}ÿQc \˜5Ì»ºeÀ¼Ø'lÑ0»O_~˜÷NÍn%BÆÑpþ–Øtj†úÙÀðœÂ€/É°QÉ}tkä@BéGàô0[$xb6ól´ƒµ'¼JàӮ,¼F´Ås :šr äl!CçβÔZþ¬9<'„Ãîˆ]$ÇÞ2Ë©C”d<ݺà¥-é WÑU^Ù£^IyN`¢°r©PY«SÂö'q¢ªsT¶ñ–T1ÒPþƒi¢ºX?…ù±À;GœP¹ÍakVC§Î;ƒÌ(Œ]–U%½!Z˜KÜCœczCÌTc„X€oô”ÿíðÊø¿¦#b.õ,Vípóþ¨Ž ¼<®gÌãèu^bY¤Ã؇'z^Ì||Kä—ä¦8‰>Ð%-záè]½¡Iàåhc7)mÅLbOŠ£½ªZyâÅ*x[Ý8RªKFv‚Æ÷[\Å4tÐR§+£Êå4·ÂeèãT¸!}0¼ÅݯØF0§5¸Í–[èŽÝÎcÓmJî9«€KuõrÔEB•ÉF©z®³îpÜNw2ë«ØåH©ø"î’7²ì"ýËÅì§ï®sŸ08]á~z•à¥‡…œ,?©²q[•õqv½âöšw6m·Q[•·‘%nä™HÀ¬;þk7Óq€›±8- Êÿ€œÚPKFÓ äu8 PKç2qAunpackaged/package.xmlMŽÍ Â0„ï}Š»ÙX¤ˆ¤é¡àUúiºjÕ$¥YEßÞÚtO3ÃÇì¨âåîì‰]l‚ÏùRHÎÐÛP7þœóãa»XóB'joìÍœ‘õ´9¿µ€L+â)t… R)3+pH¦6d¸NXŠÞ-ÆQÞ¡«ú—ºžŒ%sðC¼q¨ËG¤àvÕ¿Ð…ðר¦õ:Í„T0»DÁ4Z'PKøäÞ¢æPKç2qAFÓ äu8 !unpackaged/objects/Contact.objectPKç2qAøäÞ¢æÄunpackaged/package.xmlPK“ª
答案 0 :(得分:2)
我试过这段代码:
<?php
header('Content-Type: application/zip');
header('Content-disposition: filename="my.zip"');
$s = "UEsDBBQACAAIAOcycUEAAAAAAAAAAAAAAAAhAAAAdW5wYWNrYWdlZC9vYmplY3RzL0NvbnRhY3Qub2JqZWN01Vffb9owEH7nr4jyPpxO0zRNIRWlVKDxS5CNR2SSC/FwHGo7tPnv65CAE0CoUFYxnnKfz+fvvrtLjH3/GlFjDVyQmDXMu7plGsC82Cds0TB/u09ffpj3Ts1uJULG0XD+FzxpqC1MNMxQytVPhESMV3URxNyDuhdH6KtlfUfWNxSBxD6W2HRqhvrZwPCcwhOALxzJE7BRGcl9AgJ0a+RAQukAR+D0MFskeAFiNvNstIO1J7xK4AzTru8EmIosvEa0G8VzoDqajXKg5ABsIUPnzrLUWv6sFzk8J4TD7oidrV0kx94yy6lDlGQ83boe4KUt6QocV9FVXtmjXkkYeU5gG6KwcqlQWatTwgH2J3GiqnNUthXxllQx0lAF/oNpAqK6WI0/hfmxwDtHHwKcULnNYWtWj0OnzjuDzCiMGRhdllUlvSFamEsG3BhDAJxjekPMVGOEWIBv9JT/7fAayhD4v6YjYi71LBdW7XDz/qiOCrw8rmfM4xrodV5iWaTDF9iHJ3oCXsx8fEsD5AKX5KYYjTiJPoHQJS164QfoHV29oUng5WhjNyltxUxiT4qjvR0Qqlp54sUqeFvdOFIZqktGdoLG91tcxTR00FKnK6PK5TS3B8Jl6ONUuCERfRUwvALFHN2v2EYwpzUcuM2WW3/ojt3OY9NtF0ruOauAHEt19XLURUKVyUYaqXqus+5w3E53Muur2B0b5UipFw74FCLukjey7I0i/cvF7KfvrnOfMDhd4X56lQIP4KWHhZwCLD+psq1xW5X1cXa94vaaE3c2bbd/nVFblbeRJW7kmX9IwKw7/msBN9NxgYCbsTgtoI3K/4Cc2htQSwcIRtMK5HUCAAA4DQAAUEsDBBQACAAIAOcycUEAAAAAAAAAAAAAAAAWAAAAdW5wYWNrYWdlZC9wYWNrYWdlLnhtbE2OzQrCMBCE732KkLvZWKSIpOmh4FUP+gBpumrVJKVZRd/e2h90TzPDx+yo4uXu7IldbILP+VJIztDbUDf+nPPjYbtY80Inam/szZyR9bSPOb8QtRuAGEwr4il0FoUNDlIpM5ArcEimNmS4Tlh/it4txlEP3qGr+pe6DJ6MJQVz8EO8cajLR6TgdtUVv9AQjYXw16im9TrNhFQwu0TBNFonH1BLBwj45N4QogAAAOYAAABQSwECFAAUAAgACADnMnFBRtMK5HUCAAA4DQAAIQAAAAAAAAAAAAAAAAAAAAAAdW5wYWNrYWdlZC9vYmplY3RzL0NvbnRhY3Qub2JqZWN0UEsBAhQAFAAIAAgA5zJxQfjk3hCiAAAA5gAAABYAAAAAAAAAAAAAAAAAxAIAAHVucGFja2FnZWQvcGFja2FnZS54bWxQSwUGAAAAAAIAAgCTAAAAqgMAAAAA";
$out = base64_decode($s);
print($out);
?>
浏览器下载一个包含.xml文件的工作ZIP文件。
如果要使用PHP处理该ZIP文件的内容,可以启用php_zip扩展名并查看以下答案:Unzip a file with php