---
title: "php的session不支持数字作为key的原因"
author: "goAheadtw"
date: "2014-08-30T10:57:36Z"
tags: []
categories: ["编程语言"]
slug: "php-session-key"
draft: false
lastmod: "2014-08-30T10:57:36Z"
id: 2111028
url: "https://goaheadtw.iteye.com/blog/2111028"
---

php\_serialize is available from PHP 5.5.4. php\_serialize uses plain serialize/unserialize function internally and does not have limitations that php and php\_binary have. Older serialize handlers cannot store numeric index nor string index contains special characters (| and !) in $\_SESSION. Use php\_serialize to avoid numeric index or special character errors at script shutdown.

参考： http://stackoverflow.com/questions/18797251/notice-unknown-skipping-numeric-key-1-in-unknown-on-line-0