serialize() 將陣列轉換為物件
unserialize () 將轉換的陣列還原
<code><span>$array</span> = <span>array</span>(); <span>$array</span>[<span>'key'</span>] = <span>'website'</span>; <span>$array</span>[<span>'value'</span>]=<span>'www.chhua.com'</span>; <span>$a</span> = serialize(<span>$array</span>); print_r(<span>$a</span>); <span>$b</span> = unserialize(<span>$a</span>); print_r(<span>$b</span>);</code>
得到結果如下
以上就介紹了php serialize與unserialize函數,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。