我正在将一个插件的内容导出到另一个更健壮的插件。在我导出的数据中,有一些字段带有键。有一种方法可以独立导出每一个(在每个列中):
示例:
地址|纬度|经度|电子邮件|。。。。
UPDATE
由于建议使用“序列化”,现在要导出数据,我正在使用插件“
All Export“这允许我为自定义字段嵌入函数。
我对数据的名称有一个疑问,在自定义字段选项中,它是\\u ait-dir-item,但使用该名称则不起作用。
如果我以$mydata的形式手动执行此操作,如果有效:
function aaa() {
$mydata = \'a:52:{s:7:"address";s:59:"San José Costa Rica 100mts al Sur de Walmart en Guadalupe.";s:11:"gpsLatitude";s:9:"9.9393783";s:12:"gpsLongitude";s:18:"-84.05499370000001";s:14:"showStreetview";a:1:{s:6:"enable";s:6:"enable";}s:18:"streetViewLatitude";s:17:"9.942617316557271";s:19:"streetViewLongitude";s:18:"-84.06036884686585";s:17:"streetViewHeading";s:1:"0";s:15:"streetViewPitch";s:1:"0";s:14:"streetViewZoom";s:1:"0";s:9:"telephone";s:9:"2253-6563";s:5:"email";s:0:"";s:3:"web";s:0:"";s:11:"hoursMonday";s:15:"8:00am - 6:00pm";s:12:"hoursTuesday";s:15:"8:00am - 5:00pm";s:14:"hoursWednesday";s:7:"Cerrado";s:18:"alternativeContent";s:0:"";s:10:"socialImg1";s:0:"";s:11:"socialLink1";s:23:"http://www.facebook.com";s:10:"socialImg2";s:0:"";s:11:"socialLink2";s:22:"http://www.twitter.com";s:10:"socialImg3";s:0:"";s:11:"socialLink3";s:22:"http://plus.google.com";s:10:"socialImg4";s:0:"";s:11:"socialLink4";s:24:"http://www.instagram.com";s:10:"socialImg5";s:0:"";s:11:"socialLink5";s:24:"http://www.pinterest.com";s:10:"socialImg6";s:0:"";s:11:"socialLink6";s:0:"";s:12:"specialTitle";s:0:"";s:14:"specialContent";s:0:"";s:12:"specialImage";s:0:"";s:12:"specialPrice";s:0:"";s:8:"gallery1";s:0:"";s:8:"gallery2";s:0:"";s:8:"gallery3";s:0:"";s:8:"gallery4";s:0:"";s:8:"gallery5";s:0:"";s:8:"gallery6";s:0:"";s:8:"gallery7";s:0:"";s:8:"gallery8";s:0:"";s:8:"gallery9";s:0:"";s:9:"gallery10";s:0:"";s:9:"gallery11";s:0:"";s:9:"gallery12";s:0:"";s:9:"gallery13";s:0:"";s:9:"gallery14";s:0:"";s:9:"gallery15";s:0:"";s:9:"gallery16";s:0:"";s:9:"gallery17";s:0:"";s:9:"gallery18";s:0:"";s:9:"gallery19";s:0:"";s:9:"gallery20";s:0:"";}\';
$mydata = unserialize($mydata);
echo $mydata[\'gpsLongitude\'];
最合适的回答,由SO网友:AlbertB 整理而成
For plugin "All Export": 创建必要的函数并将其保存,然后在每个创建的字段中添加与必要字段相对应的函数名称,包含数据的变量为$value
, 示例:
function address($value){
$data = maybe_unserialize($value);
$data = $data[address];
return $data;
}
function latitud($value){
$data = maybe_unserialize($value);
$data = $data[gpsLatitude];
return $data;
}
这样,您将得到每个字段的值。