我想缓存HttpSocket->post
调用的CakePHP 2如何使用缓存::与HttpSocket-记>后的CakePHP
我打电话以下代码:
$content = Cache::remember($key, function() use ($rateUrl, $xml, $uid) {
App::uses('HttpSocket', 'Network/Http');
$HttpSocket = new HttpSocket(array('ssl_verify_peer' => false));
return $HttpSocket->post($rateUrl, $xml->asXML(), array(
'header' => array(
'Content-Type' => 'text/xml',
'RestUid' => $uid,
)
));
});
但我发现了这个错误:
The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "HttpSocketResponse" of the object you are trying to operate on was loaded before unserialize() gets called or provide a __autoload() function to load the class definition
不要任何人知道的方式如何使用HttpSocket
类的匿名函数或致电CakePHP中或以其他方式?
我尝试这样做,但didn't看到工作。 –