我不會讀,從錶行把主題列表中的 PHP scriptePHP的XML-RPC讀
$url_obj='http://'.$host.':8069/xmlrpc/object';
$sock=new xmlrpc_client($url_obj);
$msg=new xmlrpcmsg('execute');
$arrVal=array('user_id', 'name');
$msg->addParam(new xmlrpcval($db, "string"));
$msg->addParam(new xmlrpcval(1, "string"));
$msg->addParam(new xmlrpcval($pwd, "string"));
$msg->addParam(new xmlrpcval("res.partner", "string"));
$msg->addParam(new xmlrpcval("read", "string"));
$msg->addParam(new xmlrpcval(3, "int"));
//$msg->addParam(new xmlrpcval($arrVal, "struct"));
print_r("message msg=");
print_r($msg);
$resp= $sock->send($msg);
$val=$resp->value();
$read=$val->scalarval();
echo $read;
我得到的錯誤PHP的致命錯誤:非對象上調用一個成員函數scalarval()
message msg=xmlrpcmsg Object
(
[payload] =>
[methodname] => execute
[params] => Array
(
[0] => xmlrpcval Object
(
[me] => Array
(
[string] => database
)
[mytype] => 1
[_php_class] =>
)
[1] => xmlrpcval Object
(
[me] => Array
(
[string] => 1
)
[mytype] => 1
[_php_class] =>
)
[2] => xmlrpcval Object
(
[me] => Array
(
[string] => ******
)
[mytype] => 1
[_php_class] =>
)
[3] => xmlrpcval Object
(
[me] => Array
(
[string] => res.partner
)
[mytype] => 1
[_php_class] =>
)
[4] => xmlrpcval Object
(
[me] => Array
(
[string] => read
)
[mytype] => 1
[_php_class] =>
)
[5] => xmlrpcval Object
(
[me] => Array
(
[int] => 3
)
[mytype] => 1
[_php_class] =>
)
)
[debug] => 0
[content_type] => text/xml
)
PHP Fatal error: Call to a member function scalarval() on a non-object in t./est.php on line 27
PHP致命錯誤:調用一個成員函數scalarval()一個非對象在t./est.php第27行!
你能幫助我嗎?
你從服務器獲取有何反應?試試這個:'print_r($ val);'在調用'scalarval()'之前。 – 2012-03-27 21:05:10