大家好,我对 php 中的反序列化函数有疑问。问题是我在 $test 变量中有数据,例如
stdClass Object
(
[data] => a:15:{i:0;a:7:{s:2:"id";s:2:"14";s:4:"slug";s:8:"fieldset";s:4:"name";s:8:"Fieldset";s:4:"type";s:8:"fieldset";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:1;a:7:{s:2:"id";s:2:"15";s:4:"slug";s:8:"category";s:4:"name";s:8:"category";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:8:"agdjasjf";}i:2;a:7:{s:2:"id";s:1:"5";s:4:"slug";s:12:"vector-title";s:4:"name";s:12:"Vector Title";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:9:"sdjsgdjgs";}i:3;a:7:{s:2:"id";s:1:"6";s:4:"slug";s:4:"tags";s:4:"name";s:4:"Tags";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:10:"sjdjfsgdjg";}i:4;a:7:{s:2:"id";s:1:"7";s:4:"slug";s:11:"author-name";s:4:"name";s:11:"Author Name";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:12:"jhdgshdsgsdg";}i:5;a:7:{s:2:"id";s:1:"8";s:4:"slug";s:13:"email-address";s:4:"name";s:13:"Email Address";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:18:"tripathi@yahoo.com";}i:6;a:7:{s:2:"id";s:1:"9";s:4:"slug";s:11:"description";s:4:"name";s:12:"Description:";s:4:"type";s:8:"textarea";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:33:"<p>jdfkhhgdhfgdh</p>
";}i:7;a:7:{s:2:"id";s:2:"10";s:4:"slug";s:7:"license";s:4:"name";s:8:"License:";s:4:"type";s:6:"select";s:7:"options";s:239:"a:5:{i:0;s:14:"Select options";i:1;s:23:"Free For Commercial Use";i:2;s:26:"Free for personal use only";i:3;s:49:"Creative Commons Attribution 3.0 Unported License";i:4;s:61:"Creative Commons Attribution-Share Alike 3.0 Unported License";}";s:9:"parent_id";s:1:"0";s:5:"value";s:23:"Free For Commercial Use";}i:8;a:7:{s:2:"id";s:2:"11";s:4:"slug";s:49:"additional-information-about-the-license-optional";s:4:"name";s:53:"Additional Information About The License (Optional): ";s:4:"type";s:8:"textarea";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:31:"<p>sdfsdfsdfsd</p>
";}i:9;a:7:{s:2:"id";s:2:"12";s:4:"slug";s:5:"image";s:4:"name";s:7:"Image: ";s:4:"type";s:11:"file-upload";s:7:"options";s:31:"a:1:{i:0;s:13:"png|jpe?g|gif";}";s:9:"parent_id";s:1:"0";s:5:"value";s:82:"http://localhost/wordpress/wp-content/uploads/2013/01/happy-new-year-1024x7681.jpg";}i:10;a:7:{s:2:"id";s:2:"13";s:4:"slug";s:8:"zip-file";s:4:"name";s:9:"Zip File:";s:4:"type";s:11:"file-upload";s:7:"options";s:20:"a:1:{i:0;s:3:"zip";}";s:9:"parent_id";s:1:"0";s:5:"value";s:67:"http://localhost/wordpress/wp-content/uploads/2013/01/backup-11.zip";}i:11;a:7:{s:2:"id";s:2:"16";s:4:"slug";s:9:"copyright";s:4:"name";s:9:"copyright";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:16:"djfjdsjkdhfkjsdh";}i:12;a:7:{s:2:"id";s:1:"2";s:4:"slug";s:12:"verification";s:4:"name";s:12:"Verification";s:4:"type";s:12:"verification";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:13;a:7:{s:2:"id";s:1:"3";s:4:"slug";s:53:"please-enter-any-two-digits-with-no-spaces-example-12";s:4:"name";s:56:"Please enter any two digits with no spaces (Example: 12)";s:4:"type";s:6:"secret";s:7:"options";s:0:"";s:9:"parent_id";s:1:"2";s:5:"value";s:2:"14";}i:14;a:7:{s:2:"id";s:1:"4";s:4:"slug";s:13:"submit-vector";s:4:"name";s:13:"Submit Vector";s:4:"type";s:6:"submit";s:7:"options";s:0:"";s:9:"parent_id";s:1:"2";s:5:"value";s:0:"";}}
)
当我在 php 中使用反序列化函数时,传递值
$data=unserialize($test->data);
它在 server 上的$data中返回空结果。但是相同的代码在本地 xamp 服务器上工作。
我从前一天开始讨论这个问题。伙计们帮我看看这段代码中的确切问题是什么。
提前致谢 !