自定义元中的序列化数组存在问题

时间:2012-01-31 作者:turbonerd

最近,我将我的养鱼“物种档案”从一个自定义DB移到了一个自定义WordPress自定义帖子类型。

为此,我创建了一个PHP文件,该文件访问以前的数据库,提取适当的信息并将其插入WP数据库。

这适用于所有配置文件和所有连接的媒体,但我的一些references (元字段的键)不显示在后端或前端,尽管在数据库中。

以下是一个已停靠的参考,显示:

Array
(
    [0] => Array
        (
            [ref_doc_title] => The fighting fishes (Teleostei: Osphronemidae: Genus Betta) of Singapore, Malaysia and Brunei.
            [ref_pub_year] => 
            [ref_page_nums] => Raffles Bull. Zool. Supplement (13):43-99. 2005
            [ref_publishers] => 
            [ref_authors] => Tan, H.H. and P.K.L. Ng.
        )

    [1] => Array
        (
            [ref_doc_title] => The fishes of Danau Sentarum National Park and the Kapuas Lakes area, Kalimantan Barat, Indonesia.
            [ref_pub_year] => 
            [ref_page_nums] => Raffles Bull. Zool. Supplement (13):139-173. 2005
            [ref_publishers] => 
            [ref_authors] => Kottelat, M. and E. Widjanarti.
        )

    [2] => Array
        (
            [ref_doc_title] => 
            [ref_pub_year] => 
            [ref_page_nums] => www.fishbase.org
            [ref_publishers] => 
            [ref_authors] => 
        )

    [3] => Array
        (
            [ref_doc_title] => 
            [ref_pub_year] => 
            [ref_page_nums] => www.ibcbettas.org
            [ref_publishers] => 
            [ref_authors] => 
        )

    [4] => Array
        (
            [ref_doc_title] => 
            [ref_pub_year] => 
            [ref_page_nums] => www.petfrd.com
            [ref_publishers] => 
            [ref_authors] => 
        )

)
数据库中显示如下:

a:5:{i:0;a:5:{s:13:"ref_doc_title";s:94:"The fighting fishes (Teleostei: Osphronemidae: Genus Betta) of Singapore, Malaysia and Brunei.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:47:"Raffles Bull. Zool. Supplement (13):43-99. 2005";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:24:"Tan, H.H. and P.K.L. Ng.";}i:1;a:5:{s:13:"ref_doc_title";s:98:"The fishes of Danau Sentarum National Park and the Kapuas Lakes area, Kalimantan Barat, Indonesia.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:49:"Raffles Bull. Zool. Supplement (13):139-173. 2005";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:31:"Kottelat, M. and E. Widjanarti.";}i:2;a:5:{s:13:"ref_doc_title";s:0:"";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:16:"www.fishbase.org";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:0:"";}i:3;a:5:{s:13:"ref_doc_title";s:0:"";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:17:"www.ibcbettas.org";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:0:"";}i:4;a:5:{s:13:"ref_doc_title";s:0:"";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:14:"www.petfrd.com";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:0:"";}}

然后我有一个坏掉了:

Array
(
    [0] => Array
        (
            [ref_doc_title] => Revision of the family Badidae (Teleostei: Perciformes), with description of a new genus and ten new species. 
            [ref_pub_year] => 
            [ref_page_nums] => Ichthyol. Explor. Freshwat. 13(4): 295-372. 
            [ref_publishers] => 
            [ref_authors] => Kullander, S.O. and R. Britz. 2002
        )

    [1] => Array
        (
            [ref_doc_title] => Evolutionary and biogeographic patterns of the Badidae (Teleostei: Perciformes) inferred from mitochondrial and nuclear DNA sequence data.
            [ref_pub_year] => 
            [ref_page_nums] => Mol. Phylogen. and Evol. 32(3): 1010-1022.
            [ref_publishers] => 
            [ref_authors] => Rüber, L., R. Britz, S. O. Kullander and R. Zardoya. 2004
        )

)
这是它在数据库中的外观:

a:2:{i:0;a:5:{s:13:"ref_doc_title";s:110:"Revision of the family Badidae (Teleostei: Perciformes), with description of a new genus and ten new species. ";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:44:"Ichthyol. Explor. Freshwat. 13(4): 295-372. ";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:34:"Kullander, S.O. and R. Britz. 2002";}i:1;a:5:{s:13:"ref_doc_title";s:138:"Evolutionary and biogeographic patterns of the Badidae (Teleostei: Perciformes) inferred from mitochondrial and nuclear DNA sequence data.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:42:"Mol. Phylogen. and Evol. 32(3): 1010-1022.";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:57:"Rüber, L., R. Britz, S. O. Kullander and R. Zardoya. 2004";}}

我在后端使用的代码如下:

function meta_references() {
    global $post;

    if ($post) {
        $references = get_post_meta( $post->ID , \'references\', TRUE );
        if (get_post_meta( $post->ID, \'ref_type_desc\', TRUE) != "") {
            $ref_type_desc = get_post_meta( $post->ID, \'ref_type_desc\', TRUE);
        } else {
            $ref_type_desc = -1;
        }
    }
    ?>
<div class="meta_control normal">
    <div id="references_wrapper">
        <p>Click <a href="javascript:void(0);" id="add_reference">here</a> to add a new reference.</p>
    <?php
        if (!empty($references)) {
            $count = count($references);
            for ($i = 1; $i <= $count; $i++) {
                if ($ref_type_desc != -1 && $i == $ref_type_desc) {
                    $this->print_reference($i, $references[$i-1], TRUE);
                } else {
                    $this->print_reference($i, $references[$i-1]);
                }
            }
        } else {
            $this->print_reference(1);
        }
    ?>
        <p>Click <a href="javascript:void(0);" id="uncheck_ref_radio">here</a> to unset the Type Description buttons.</p>
    </div>
</div>
    <?php
}

function print_reference($i, $array = NULL, $type_desc = NULL) {
    // any information below must be changed in references.js
    ?>
<div class="reference">
    <h3>Reference <?php echo $i; ?></h3>
    <div class="line double">
        <label>Author(s)</label> <input type="text" name="ref_authors[]" value="<?php if (isset($array["ref_authors"])) { echo $array["ref_authors"]; } ?>" />
        <label>Publisher</label> <input type="text" name="ref_publishers[]" value="<?php if (isset($array["ref_publishers"])) { echo $array["ref_publishers"]; } ?>" />
    </div>
    <div class="line double">
        <label>Publication Year</label> <input type="text" name="ref_pub_year[]" value="<?php if (isset($array["ref_pub_year"])) { echo $array["ref_pub_year"]; } ?>" />
        <label>Page Number(s)</label> <input type="text" name="ref_page_nums[]"  value="<?php if (isset($array["ref_page_nums"])) { echo $array["ref_page_nums"]; } ?>" />
    </div>
    <div class="line"><label>Document Title</label> <input type="text" name="ref_doc_title[]" value="<?php if (isset($array["ref_doc_title"])) { echo $array["ref_doc_title"]; } ?>" /></div>
    <div class="line"><label style="width:150px;">Type Description?</label> <input type="radio" class="ref_type_desc" name="ref_type_desc" style="padding-top:5px;margin-top:5px;" value="<?php echo $i; ?>"<?php if ($type_desc == TRUE) { echo \'checked = "checked"\'; } ?> /></div>
    <div style="clear:both;line-height:0;margin:0;padding:0;">&nbsp;</div>
    <p>Click <a href="javascript:void(0);" id="<?php echo $i; ?>_del_reference">here</a> to remove Reference #<?php echo $i; ?>.</p>
</div>
    <?php
}
我在前端使用的代码是:

if (get_post_meta($post->ID, \'references\', TRUE) != "") {
    $references = get_post_meta($post->ID, \'references\', TRUE);
    if (strlen($references[0]["ref_doc_title"]) > 0) {
        echo \'<h2 id="references" class="profile_literaturecited">References</h2>\' . "\\n";

        echo \'<ol>\';

        if (get_post_meta($post->ID, \'ref_type_desc\', TRUE) != "") {
            $type_desc = get_post_meta($post->ID, \'ref_type_desc\', TRUE);

            $count = count($references);

            for ($i = 1; $i <= $count; $i++) {
                if ($i == $type_desc) {
                    $n = $i - 1;
                    $r = $references[$n];
                    echo \'<li class="type_desc">\';
                    echo \'<strong>\' . $r["ref_authors"] . \', \' . $r["ref_pub_year"] . \'</strong>\';
                    echo \' - \' . $r["ref_publishers"] . \': \' . $r["ref_page_nums"];
                    echo \'<br />\' . $r["ref_doc_title"];
                    echo \'</li>\';

                    unset($references[$n]);
                }
            }
        }
        // user defined sort comparison. use lowercase to ensure sort is accurate
        function cmp($a, $b)
        {
            $al = strtolower($a["ref_authors"]);
            $bl = strtolower($b["ref_authors"]);
            if ($al == $bl) {
                return 0;
            }
            return ($al > $bl) ? +1 : -1;
        }

        usort($references, "cmp");

        foreach ($references as $r) {
            echo \'<li>\';
            echo \'<strong>\' . $r["ref_authors"] . \', \' . $r["ref_pub_year"] . \'</strong>\';
            echo \' - \' . $r["ref_publishers"] . \': \' . $r["ref_page_nums"];
            echo \'<br />\' . $r["ref_doc_title"];
            echo \'</li>\';
        }
        echo \'</ol>\';
    }
}

Nothing at all displays in the back-end or front-end for any of these "non-working" references, yet the entries are in the database with the correct post ID and meta_key.

所以我想知道,对于WordPress的使用,这个序列化数组(非工作数组)的格式是否有误?我不认为PHP标准对它的格式有任何错误print_r 使用unserialize 命令

任何帮助都将不胜感激,我想我快疯了!

EDIT for Chip

以下是您的代码的(节略)输出,其中一个物种配置文件没有显示引用。我删除了其他元字段的冗长片段,但留下了另外两个元打印输出,以显示它们是如何返回的。

array(19) {
  ["genus"]=>
  array(1) {
    [0]=>
    string(20) "Yasuhikotakia"
  }
  ["species"]=>
  array(1) {
    [0]=>
    string(16) "splendida"
  }
。。。。

 ["references"]=>
  array(1) {
    [0]=>
    string(4117) "a:12:{i:0;a:5:{s:13:"ref_doc_title";s:74:"Genetic variation of five species of Yasuhikotakia in Thailand using AFLP.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:48:"Journal of Agricultural Technology 6(4): 761-766";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:60:"Arthainsee, A., T. Leamkom, A. Jutagate and S. Chundum. 2010";}i:1;a:5:{s:13:"ref_doc_title";s:48:"The Botia modesta complex (Cobitidae, Botiinae).";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:22:"Ichthyofile No. 1: 1-8";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:14:"Grant, S. 2001";}i:2;a:5:{s:13:"ref_doc_title";s:15:"Fishes of Laos.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:52:"WHT Publications Ltd., Colombo 5, Sri Lanka. 198 p. ";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:17:"Kottelat, M. 2001";}i:3;a:5:{s:13:"ref_doc_title";s:168:"Botia kubotai, a new species of loach (Teleostei: Cobitidae) from the ataran River basin (Myanmar), with comments on botiinae nomenclature and diagnosis of a new genus.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:17:"Zootaxa 401: 1-18";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:17:"Kottelat, M. 2004";}i:4;a:5:{s:13:"ref_doc_title";s:96:"Sixty million years of evolution. Part one: family Botiidae (Pisces: Ostariophysi: Cobitoidea). ";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:81:"Travaux du Museum d\'Histoire Naturelle "Grigore Antipa" 44: 309-333";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:19:"Nalbant, T. T. 2002";}i:5;a:5:{s:13:"ref_doc_title";s:128:"Hymenphysa, Hymenophysa, Syncrossus, Chromobotia and other problems in the systematics of Botiidae. A reply to Maurice Kottelat.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:82:"Travaux du Museum d\'Histoire Naturelle "Grigore Antipa" 47: 269-277.";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:19:"Nalbant, T. T. 2004";}i:6;a:5:{s:13:"ref_doc_title";s:90:"Botia splendida, a new species of loach (Pisces: Cobitidae) from the Mekong Basin in Laos.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:46:"The Raffles Bulletin of Zoology 43(2): 463-467";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:19:"Roberts, T. R. 1995";}i:7;a:5:{s:13:"ref_doc_title";s:147:"Molecular phylogeny of the Southeast Asian freshwater fish family Botiidae (Teleostei: Cobitoidea) and the origin of polyploidy in their evolution.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:49:"Molecular Phylogenetics and Evolution 39: 529-541";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:53:"Šlechtová, V., J. Bohlen, J. Freyhof and P. Ráb. 2006";}i:8;a:5:{s:13:"ref_doc_title";s:188:"Families of Cobitoidea (Teleostei; Cypriniformes) as revealed from nuclear genetic data and the position of the mysterious genera Barbucca, Psilorhynchus, Serpenticobitis and Vaillantella.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:54:"Molecular Phylogenetics and Evolution 44(3): 1358-1365";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:44:"Šlechtová, V., J. Bohlen and H. H. Tan. 2007";}i:9;a:5:{s:13:"ref_doc_title";s:72:"Two new species of the cobitid genus [ì]Botia from the Lao Mekong Basin.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:46:"Japanese Journal of Ichthyology 42(2): 147-155";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:25:"Taki, Y. and A. Doi. 1995";}i:10;a:5:{s:13:"ref_doc_title";s:126:"Phylogeny of the East Asian botiine loaches (Cypriniformes, Botiidae) inferred from mitochondrial cytochrome b gene sequences.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:29:"Hydrobiologia 544(1): 249-258";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:44:"Tang, Q., B. Xiong, X. Yang and H. Liu. 2005";}i:11;a:5:{s:13:"ref_doc_title";s:177:"Comparison of evolutionary rates in the mitochondrial DNA cytochrome b gene and control region and their implications for phylogeny of the Cobitoidea (Teleostei: Cypriniformes).";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:52:"Molecular Phylogenetics and Evolution 39(2): 347-357";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:46:"Tang, Q., H. Liu, R. Mayden and B. Xiong. 2006";}}"
  }
  ["_thumbnail_id"]=>
  array(1) {
    [0]=>
    string(5) "25351"
  }
  ["attached_media"]=>
  array(1) {
    [0]=>
    string(156) "a:12:{i:0;i:25351;i:1;i:25352;i:2;i:25353;i:3;i:25354;i:4;i:25355;i:5;i:25356;i:6;i:25357;i:7;i:25358;i:8;i:25359;i:9;i:253510;i:10;i:253511;i:11;i:253512;}"
  }
在其中一个有效的配置文件上,它以类似的方式显示:

["references"]=>
  array(1) {
    [0]=>
    string(1145) "a:5:{i:0;a:5:{s:13:"ref_doc_title";s:94:"The fighting fishes (Teleostei: Osphronemidae: Genus Betta) of Singapore, Malaysia and Brunei.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:47:"Raffles Bull. Zool. Supplement (13):43-99. 2005";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:24:"Tan, H.H. and P.K.L. Ng.";}i:1;a:5:{s:13:"ref_doc_title";s:98:"The fishes of Danau Sentarum National Park and the Kapuas Lakes area, Kalimantan Barat, Indonesia.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:49:"Raffles Bull. Zool. Supplement (13):139-173. 2005";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:31:"Kottelat, M. and E. Widjanarti.";}i:2;a:5:{s:13:"ref_doc_title";s:0:"";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:16:"www.fishbase.org";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:0:"";}i:3;a:5:{s:13:"ref_doc_title";s:0:"";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:17:"www.ibcbettas.org";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:0:"";}i:4;a:5:{s:13:"ref_doc_title";s:0:"";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:14:"www.petfrd.com";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:0:"";}}"
  }
**最终编辑**

@goldenapples的回答是正确的。

我现在就Stackoverflow提出了一个新问题(因为它不是WordPress特有的)。

https://stackoverflow.com/questions/9088910/migrating-data-from-latin1-charset-to-utf-8

如果你们中有人能帮忙,我们将不胜感激!

2 个回复
最合适的回答,由SO网友:goldenapples 整理而成

请参见我对上述问题的评论。我刚刚意识到,如果您在数据库中使用了这些特殊字符,很可能在将数据保存到数据库之前没有对其进行清理。尝试运行htmlentities() 查看要保存到该序列化数组中的所有值,并查看是否最终得到可读的结果。

SO网友:Chip Bennett

你读过Codex entry for get_post_meta()?

它注意到,序列化数组的元数据是一种特殊情况,主要影响$single 中的参数get_post_meta($post_id, $key, $single) 电话:

$单个

(布尔)(可选)如果设置为true,则函数将以字符串形式返回单个结果。如果为false或未设置,则该函数返回一个自定义字段数组。这是不直观的。例如,如果使用此方法获取序列化数组,则希望$single为true以实际获取未序列化数组。如果传入false或不传入,则将有一个1的数组,索引0处的值将是序列化字符串。

默认值:false

不过,您似乎处理得很好。

要查看WordPress是否可以正确读取数组,请尝试以下操作:

<?php
$post_references = ( get_post_meta( $post->ID , \'references\', TRUE ) ? get_post_meta( $post->ID , \'references\', TRUE ) : false );
var_dump( $post_references );
?>
我怀疑这将返回您的阵列;在这种情况下,您只需进入:

<?php
foreach ( $post_references as $post_reference ) {
    // Get the ref doc title
    $ref_doc_title = $post_reference[\'ref_doc_title\'];
    // Do whatever you need/want here;
    // Output a list, or whatever
}
?>
但是如果它没有返回您的数组,我们需要找出问题可能出在哪里。

编辑它在引用未出现在前端或后端的配置文件上返回bool(false)(如示例2所示)。。。

这意味着get_post_meta() 它本身没有为references 相关职位的元字段。让我们看看WordPress在这篇文章中找到了什么自定义元数据:

<?php
$all_post_custom_data = get_post_custom( $post->ID );
var_dump( $all_post_custom_data );
?>
是的references 是否显示在此var\\u转储中?如果是,它看起来是什么样子?

根据var\\U转储结果编辑2:

["references"]=>
  array(1) {
    [0]=>
    string(4117) "a:12:{i:0;a:5:{s:13:"ref_doc_title";s:74:"Genetic variation of five species of Yasuhikotakia in Thailand using AFLP.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:48:"Journal of Agricultural Technology 6(4): 761-766";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:60:"Arthainsee, A., T. Leamkom, A. Jutagate and S. Chundum. 2010";}i:1;a:5:{s:13:"ref_doc_title";s:48:"The Botia modesta complex (Cobitidae, Botiinae).";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:22:"Ichthyofile No. 1: 1-8";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:14:"Grant, S. 2001";}i:2;a:5:{s:13:"ref_doc_title";s:15:"Fishes of Laos.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:52:"WHT Publications Ltd., Colombo 5, Sri Lanka. 198 p. ";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:17:"Kottelat, M. 2001";}i:3;a:5:{s:13:"ref_doc_title";s:168:"Botia kubotai, a new species of loach (Teleostei: Cobitidae) from the ataran River basin (Myanmar), with comments on botiinae nomenclature and diagnosis of a new genus.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:17:"Zootaxa 401: 1-18";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:17:"Kottelat, M. 2004";}i:4;a:5:{s:13:"ref_doc_title";s:96:"Sixty million years of evolution. Part one: family Botiidae (Pisces: Ostariophysi: Cobitoidea). ";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:81:"Travaux du Museum d\'Histoire Naturelle "Grigore Antipa" 44: 309-333";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:19:"Nalbant, T. T. 2002";}i:5;a:5:{s:13:"ref_doc_title";s:128:"Hymenphysa, Hymenophysa, Syncrossus, Chromobotia and other problems in the systematics of Botiidae. A reply to Maurice Kottelat.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:82:"Travaux du Museum d\'Histoire Naturelle "Grigore Antipa" 47: 269-277.";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:19:"Nalbant, T. T. 2004";}i:6;a:5:{s:13:"ref_doc_title";s:90:"Botia splendida, a new species of loach (Pisces: Cobitidae) from the Mekong Basin in Laos.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:46:"The Raffles Bulletin of Zoology 43(2): 463-467";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:19:"Roberts, T. R. 1995";}i:7;a:5:{s:13:"ref_doc_title";s:147:"Molecular phylogeny of the Southeast Asian freshwater fish family Botiidae (Teleostei: Cobitoidea) and the origin of polyploidy in their evolution.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:49:"Molecular Phylogenetics and Evolution 39: 529-541";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:53:"Šlechtová, V., J. Bohlen, J. Freyhof and P. Ráb. 2006";}i:8;a:5:{s:13:"ref_doc_title";s:188:"Families of Cobitoidea (Teleostei; Cypriniformes) as revealed from nuclear genetic data and the position of the mysterious genera Barbucca, Psilorhynchus, Serpenticobitis and Vaillantella.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:54:"Molecular Phylogenetics and Evolution 44(3): 1358-1365";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:44:"Šlechtová, V., J. Bohlen and H. H. Tan. 2007";}i:9;a:5:{s:13:"ref_doc_title";s:72:"Two new species of the cobitid genus [ì]Botia from the Lao Mekong Basin.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:46:"Japanese Journal of Ichthyology 42(2): 147-155";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:25:"Taki, Y. and A. Doi. 1995";}i:10;a:5:{s:13:"ref_doc_title";s:126:"Phylogeny of the East Asian botiine loaches (Cypriniformes, Botiidae) inferred from mitochondrial cytochrome b gene sequences.";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:29:"Hydrobiologia 544(1): 249-258";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:44:"Tang, Q., B. Xiong, X. Yang and H. Liu. 2005";}i:11;a:5:{s:13:"ref_doc_title";s:177:"Comparison of evolutionary rates in the mitochondrial DNA cytochrome b gene and control region and their implications for phylogeny of the Cobitoidea (Teleostei: Cypriniformes).";s:12:"ref_pub_year";s:0:"";s:13:"ref_page_nums";s:52:"Molecular Phylogenetics and Evolution 39(2): 347-357";s:14:"ref_publishers";s:0:"";s:11:"ref_authors";s:46:"Tang, Q., H. Liu, R. Mayden and B. Xiong. 2006";}}"
  }
我们可以说references 正在存储为串行数组字符串。可能或可能不符合预期;你从工作岗位上得到同样的信息吗references 元数据?

看起来您需要做以下两件事之一:

重新导入未序列化的数据,以便在输出数据时可以按照正常方式访问数据get_post_meta() 甚至没有归还任何东西references.

Ultimately, I think the answer is that your import script imported some data serialized, and some data unserialized. 解决方案可能是重新导入数据,以便一致地导入所有数据。

结束

相关推荐