任何人都可以帮忙解决这个错误吗?
感谢。
echo $baslik.' yazı eklendi. ID = '.$postid;
你可以看到下面的行,谢谢。
$postid=wp_insert_post( $my_post );
add_post_meta($postid, 'target', $md5);
add_post_meta($postid, 'psp_meta', 'a:19:{s:5:"title";s:13:"'.stripslashes($baslik).'";s:11:"description";s:15:"'. $HaberOzet.'";s:8:"keywords";s:27:"'. $etiket.'";s:13:"focus_keyword";s:0:"";s:17:"facebook_isactive";s:2:"no";s:14:"facebook_titlu";s:0:"";s:13:"facebook_desc";s:0:"";s:14:"facebook_image";s:0:"";s:23:"facebook_opengraph_type";s:7:"article";s:12:"robots_index";s:7:"default";s:13:"robots_follow";s:7:"default";s:8:"priority";s:1:"-";s:9:"canonical";s:0:"";s:21:"psp_twc_post_cardtype";s:7:"summary";s:20:"psp_twc_app_isactive";s:2:"no";s:22:"psp_twc_post_thumbsize";s:7:"120x120";s:13:"psp_twc_title";s:0:"";s:19:"psp_twc_description";s:0:"";s:13:"psp_twc_image";s:0:"";}')
echo $baslik.' yazı eklendi. ID = '.$postid;
}else{
echo 'DAHA ÖNCE EKLENMİŠHABER';
}
答案 0 :(得分:0)
在它之前的行尾没有分号,对add_post_meta(...)
的大量调用
正确的代码是:
$postid=wp_insert_post( $my_post );
add_post_meta($postid, 'target', $md5);
add_post_meta($postid, 'psp_meta', 'a:19:{s:5:"title";s:13:"'.stripslashes($baslik).'";s:11:"description";s:15:"'. $HaberOzet.'";s:8:"keywords";s:27:"'. $etiket.'";s:13:"focus_keyword";s:0:"";s:17:"facebook_isactive";s:2:"no";s:14:"facebook_titlu";s:0:"";s:13:"facebook_desc";s:0:"";s:14:"facebook_image";s:0:"";s:23:"facebook_opengraph_type";s:7:"article";s:12:"robots_index";s:7:"default";s:13:"robots_follow";s:7:"default";s:8:"priority";s:1:"-";s:9:"canonical";s:0:"";s:21:"psp_twc_post_cardtype";s:7:"summary";s:20:"psp_twc_app_isactive";s:2:"no";s:22:"psp_twc_post_thumbsize";s:7:"120x120";s:13:"psp_twc_title";s:0:"";s:19:"psp_twc_description";s:0:"";s:13:"psp_twc_image";s:0:"";}');
echo $baslik.' yazı eklendi. ID = '.$postid;
}else{
echo 'DAHA ÖNCE EKLENMİŠHABER';
}
PS:除非您知道stripslashes($baslik)
的长度始终为13个字符,并且$HaberOzet
的长度始终为15个字符,否则您的代码可能容易出错。