我在反序列化 curl 响应时收到“ Notice: unserialize(): Error at offset 0 of 1081 bytes ”错误。
卷曲请求页面 - ping1.php:
<?php
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => "http://example.com/test/curl/ping2.php",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
curl_close($ch);
echo unserialize($result);
?>
卷曲响应页面 - ping2.php
<?php
$data=array('test'=>1,'testing'=>2);
echo serialize($data);
?>