PHPシリアル化に問題があります。これが含まれていると余分な文字スペースがあります。それは私が7PHPシリアライゼーションエラーが2文字でカウントされます
$episodes_count = sizeof($episode_title);
$episodes = array();
$content = '';
for ($i = 0; $i <= $episodes_count; $i++) {
$title = htmlspecialchars($episode_title[$i], ENT_QUOTES);
$airdate = $episodes_airdates[$i];
$season = $episodes_seasons[$i];
$number = $episodes_numbers[$i];
$plot = $episodes_plot[$i];
// check if empty
if (!empty($title) && !empty($number) && !empty($plot)) {
$episodes[] = array(
'title' => $title,
'airdate' => $airdate,
'season' => $season,
'number' => $number,
'plot' => $plot,
);
}
}
// Serialized Episodes in case they exist, if not, remove the goal post
if (sizeof($episodes) > 0) {
$content = str_replace("'", '%',serialize($episodes));
}
update_post_meta($post_id, 'episodes', $content);
}
人は 'sizeof()'を使用しますか? :)余分な空白を整えたり、タイトルから二重引用符をエスケープしようとしていますか? – MetalFrog
wordpressがシリアル化されていない文字列を非シリアル化として処理するとは思わないでください。ポストメタは自動的にシリアライズされますが、それは起こるかもしれないし、そうでないかもしれません。そして、これが再び読み込まれると、シリアライズされたとして評価されますが、文字列を変更したため、 – hakre
@MetalFrogはい私はsizeof()、lolを使用します。あなたの他の質問に答えるために、私は空白を取り除こうとしていました。 – Craig