我有一个示例代码:
$text = 'a:3:{s:2:"id";s:18:"nokiainternal_ver1";s:10:"user_agent";s:13:"NokiaInternal";s:9:"fall_back";s:13:"nokia_generic";}';
$text = unserialize($text);
if(isset($text['model_name'])) {
$text['model_name'] = 'Nokia';
}
echo $text['model_name'];
echo $text['user_agent'];
但结果错误Notice: Undefined index: model_name ...
如何解决?