【问题标题】:PHP XMLRPC Moodle function calling parameters do not match signaturePHP XMLRPC Moodle 函数调用参数与签名不匹配
【发布时间】:2016-04-29 17:52:16
【问题描述】:

我不知道如何正确传递函数 core_user_get_users_by_field 所需的参数

Moodle 函数文档包含在下面。

这是 Moodle 类中无法正常工作的函数。

// The getUser function obtains information for a Moodle user identified by its id.
function getUser($user_id) {
// Clear last error.
$this->error = null;

// Create XML for the request. XML must be set properly for this to work.
$request = xmlrpc_encode_request('core_user_get_users_by_field', array(array((string) $user_id)), array('encoding'=>'UTF-8'));

这个 sn-p 是引发错误的部分。

array(array((string) $user_id))

功能 文档------------------------------------------------ -- core_user_get_users_by_field

检索指定唯一字段的用户信息 - 如果需要 要进行用户搜索,请使用 core_user_get_users()

参数字段(必填) 搜索字段可以是 'id' 或 'idnumber' 或 'username' 或 'email'

一般结构

string //搜索字段可以是 'id' 或 'idnumber' 或 'username' 或 'email'

XML-RPC(PHP 结构)

[field] => 字符串 REST(POST 参数)

字段=字符串

值(必需)

一般结构

(字符串//要匹配的值)XML-RPC(PHP 结构)列表

[值] => 大批 ( [0] => 字符串 ) REST(POST 参数)

值[0]=字符串

【问题讨论】:

    标签: php moodle xml-rpc


    【解决方案1】:

    我想通了....见下面的sn-p。

    $request = xmlrpc_encode_request('core_user_get_users_by_field', array("id", array((string)$user_id)), array('encoding'=>'UTF-8'));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-12
      • 1970-01-01
      • 1970-01-01
      • 2018-03-24
      • 2017-11-23
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多