Reputation: 34207
132
a:4:{s:8:"template";a:1:{s:10:"index.html";b:1;}s:9:"timestamp";i:1256373019;s:7:"expires";i:1256373079;s:13:"cache_serials";a:0:{}}<body>
php<br >
java<br >
c++<br >
</body>
Can someone explain this part:
132
a:4:{s:8:"template";a:1:{s:10:"index.html";b:1;}s:9:"timestamp";i:1256373019;s:7:"expires";i:1256373079;s:13:"cache_serials";a:0:{}}
Upvotes: 0
Views: 164
Reputation: 3102
It is a serialized version of an PHP array:
<?php
$serialized = 'a:4:{s:8:"template";a:1:{s:10:"index.html";b:1;}s:9:"timestamp";i:1256373019;s:7:"expires";i:1256373079;s:13:"cache_serials";a:0:{}}';
$unserialized = unserialize($serialized);
print_r($unserialized);
Results in:
Array
(
[template] => Array
(
[index.html] => 1
)
[timestamp] => 1256373019
[expires] => 1256373079
[cache_serials] => Array
(
)
)
Upvotes: 1
Reputation: 2871
I don't know much about Smarty, but that looks like something similar to Bencoding, which is where you encode things like strings and arrays by specifying their lengths first. This avoids having to delimit such things with "special characters" (such as quotes) which then need to be "escaped" if they appear in the real string.
132
is the length of the encoded string.a:4:
looks like it's introducing an associative array (dictionary) with 4 items.s:8:"template"
seems to be a string of length 8, with the value "template". In this case, it is the key of the first item in the dictionary.Upvotes: 1