wordpress XML-RPC UTF-8
我使用XML-RPC添加帖子,虽然效果很好,但字符不正确(utf-8) 我在用这个wordpress XML-RPC UTF-8,wordpress,utf-8,xml-rpc,Wordpress,Utf 8,Xml Rpc,我使用XML-RPC添加帖子,虽然效果很好,但字符不正确(utf-8) 我在用这个 <?php include('IXR_Library.php'); $client = new IXR_Client('http://localhost/wordpress2/xmlrpc.php'); $content['title'] = 'Test title '.mt_rand(); $content['categories'] = array("NewCatego
<?php
include('IXR_Library.php');
$client = new IXR_Client('http://localhost/wordpress2/xmlrpc.php');
$content['title'] = 'Test title '.mt_rand();
$content['categories'] = array("NewCategory","Nothing");
$content['description'] = '<p>Lorem ?rmak ipsum dolor sit amet</p>';
$content['custom_fields'] = array( array('key' => 'my_custom_fied','value'=>'yes') );
$content['mt_keywords'] = array('foo','bar');
$params = array(0, 'user','pass',$content,true);
// if (!$client->query(xmlrpc_encode_request('metaWeblog.newPost',$params, array('encoding'=>'UTF-8','escaping'=>'markup')))) {
if (!$client->query('metaWeblog.newPost',$params)) {
die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());
}
$ID = $client->getResponse();
if($ID)
{
echo 'Post published with ID:#'.$ID;
}
?>
我将如何解决这个问题 你能具体说明什么不起作用吗?你的要求是什么?你在说什么不正确的字符?嗨,大卫,当我使用'if(!$client->query('metaWeblog.newPost',$params')'时,什么都不保存。例如,我使用字符utf-8作为标题,但标题为空,标题中没有任何内容。当使用
if(!$client->query(xmlrpc_encode_请求('metaWeblog.newPost',$params,array('encoding'=>'UTF-8','escaping'=>'markup'))时,
脚本在我使用if(!$client->query('metaWeblog.newPost',$params'))时不起作用。
不保存任何内容。例如,我使用字符utf-8作为标题,但标题为空,标题中没有任何内容。但是对于英文字符脚本工作和使用if(!$client->query(xmlrpc_encode_请求('metaWeblog.newPost',$params,array('encodeding'=>'UTF-8','escaping'=>'markup'))
脚本不工作,帖子不会发布
xmlrpc_encode_request('metaWeblog.newPost',$params, array('encoding'=>'UTF-8','escaping'=>'markup'))