我想緩存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看到工作。 –