| 包 | XS | 
|---|---|
| 继承关系 | class XSCommand » XSComponent | 
| 版本 | 1.0.0 | 
| 源代码 | sdk/php/lib/XSServer.class.php | 
| 名称 | 类型 | 描述 | 定义于 | 
|---|---|---|---|
| arg | int | 获取属性 arg 的值 | XSCommand | 
| arg1 | int | 参数1 取值范围 0~255, 具体含义根据不同的 CMD 而变化 | XSCommand | 
| arg2 | int | 参数2 取值范围 0~255, 常用于存储 value no, 具体参照不同 CMD 而确定 | XSCommand | 
| buf | string | 主数据内容, 最长 2GB | XSCommand | 
| buf1 | string | 辅数据内容, 最长 255字节 | XSCommand | 
| cmd | int | 命令代码 通常是预定义常量 XS_CMD_xxx, 取值范围 0~255 | XSCommand | 
| 名称 | 描述 | 定义于 | 
|---|---|---|
| __construct() | 构造函数 | XSCommand | 
| __get() | 魔术方法 __get | XSComponent | 
| __isset() | 魔术方法 __isset | XSComponent | 
| __set() | 魔术方法 __set | XSComponent | 
| __toString() | 转换为封包字符串 | XSCommand | 
| __unset() | 魔术方法 __unset | XSComponent | 
| getArg() | 获取属性 arg 的值 | XSCommand | 
| setArg() | 设置属性 arg 的值 | XSCommand | 
获取属性 arg 的值
参数1 取值范围 0~255, 具体含义根据不同的 CMD 而变化
参数2 取值范围 0~255, 常用于存储 value no, 具体参照不同 CMD 而确定
主数据内容, 最长 2GB
辅数据内容, 最长 255字节
命令代码 通常是预定义常量 XS_CMD_xxx, 取值范围 0~255
| 
public void __construct(mixed $cmd, int $arg1=0, int $arg2=0, string $buf='', string $buf1='') | ||
| $cmd | mixed | 命令类型或命令数组 当类型为 int 表示命令代码, 范围是 1~255, 参见 xs_cmd.inc.php 里的定义 当类型为 array 时忽略其它参数, 可包含 cmd, arg1, arg2, buf, buf1 这些键值 | 
| $arg1 | int | 参数1, 其值为 0~255, 具体含义视不同 CMD 而确定 | 
| $arg2 | int | 参数2, 其值为 0~255, 具体含义视不同 CMD 而确定, 常用于存储 value no | 
| $buf | string | 字符串内容, 最大长度为 2GB | 
| $buf1 | string | 字符串内容1, 最大长度为 255字节 | 
public function __construct($cmd, $arg1 = 0, $arg2 = 0, $buf = '', $buf1 = '')
{
    if (is_array($cmd)) {
        foreach ($cmd as $key => $value) {
            if ($key === 'arg' || property_exists($this, $key)) {
                $this->$key = $value;
            }
        }
    } else {
        $this->cmd = $cmd;
        $this->arg1 = $arg1;
        $this->arg2 = $arg2;
        $this->buf = $buf;
        $this->buf1 = $buf1;
    }
}
构造函数
| 
public string __toString() | ||
| {return} | string | 用于服务端交互的字符串 | 
public function __toString()
{
    if (strlen($this->buf1) > 0xff) {
        $this->buf1 = substr($this->buf1, 0, 0xff);
    }
    return pack('CCCCI', $this->cmd, $this->arg1, $this->arg2, strlen($this->buf1), strlen($this->buf)) . $this->buf . $this->buf1;
}
转换为封包字符串
| 
public int getArg() | ||
| {return} | int | 参数值 | 
public function getArg()
{
    return $this->arg2 | ($this->arg1 << 8);
}
获取属性 arg 的值
| 
public void setArg(int $arg) | ||
| $arg | int | 参数值 | 
public function setArg($arg)
{
    $this->arg1 = ($arg >> 8) & 0xff;
    $this->arg2 = $arg & 0xff;
}
设置属性 arg 的值
| 包 | XS | 
|---|---|
| 继承关系 | class XSCommand » XSComponent | 
| 版本 | 1.0.0 | 
| 源代码 | sdk/php/lib/XSServer.class.php | 
| 名称 | 类型 | 描述 | 定义于 | 
|---|---|---|---|
| arg | int | 获取属性 arg 的值 | XSCommand | 
| arg1 | int | 参数1 取值范围 0~255, 具体含义根据不同的 CMD 而变化 | XSCommand | 
| arg2 | int | 参数2 取值范围 0~255, 常用于存储 value no, 具体参照不同 CMD 而确定 | XSCommand | 
| buf | string | 主数据内容, 最长 2GB | XSCommand | 
| buf1 | string | 辅数据内容, 最长 255字节 | XSCommand | 
| cmd | int | 命令代码 通常是预定义常量 XS_CMD_xxx, 取值范围 0~255 | XSCommand | 
| 名称 | 描述 | 定义于 | 
|---|---|---|
| __construct() | 构造函数 | XSCommand | 
| __get() | 魔术方法 __get | XSComponent | 
| __isset() | 魔术方法 __isset | XSComponent | 
| __set() | 魔术方法 __set | XSComponent | 
| __toString() | 转换为封包字符串 | XSCommand | 
| __unset() | 魔术方法 __unset | XSComponent | 
| getArg() | 获取属性 arg 的值 | XSCommand | 
| setArg() | 设置属性 arg 的值 | XSCommand | 
获取属性 arg 的值
参数1 取值范围 0~255, 具体含义根据不同的 CMD 而变化
参数2 取值范围 0~255, 常用于存储 value no, 具体参照不同 CMD 而确定
主数据内容, 最长 2GB
辅数据内容, 最长 255字节
命令代码 通常是预定义常量 XS_CMD_xxx, 取值范围 0~255
| 
public void __construct(mixed $cmd, int $arg1=0, int $arg2=0, string $buf='', string $buf1='') | ||
| $cmd | mixed | 命令类型或命令数组 当类型为 int 表示命令代码, 范围是 1~255, 参见 xs_cmd.inc.php 里的定义 当类型为 array 时忽略其它参数, 可包含 cmd, arg1, arg2, buf, buf1 这些键值 | 
| $arg1 | int | 参数1, 其值为 0~255, 具体含义视不同 CMD 而确定 | 
| $arg2 | int | 参数2, 其值为 0~255, 具体含义视不同 CMD 而确定, 常用于存储 value no | 
| $buf | string | 字符串内容, 最大长度为 2GB | 
| $buf1 | string | 字符串内容1, 最大长度为 255字节 | 
public function __construct($cmd, $arg1 = 0, $arg2 = 0, $buf = '', $buf1 = '')
{
    if (is_array($cmd)) {
        foreach ($cmd as $key => $value) {
            if ($key === 'arg' || property_exists($this, $key)) {
                $this->$key = $value;
            }
        }
    } else {
        $this->cmd = $cmd;
        $this->arg1 = $arg1;
        $this->arg2 = $arg2;
        $this->buf = $buf;
        $this->buf1 = $buf1;
    }
}
构造函数
| 
public string __toString() | ||
| {return} | string | 用于服务端交互的字符串 | 
public function __toString()
{
    if (strlen($this->buf1) > 0xff) {
        $this->buf1 = substr($this->buf1, 0, 0xff);
    }
    return pack('CCCCI', $this->cmd, $this->arg1, $this->arg2, strlen($this->buf1), strlen($this->buf)) . $this->buf . $this->buf1;
}
转换为封包字符串
| 
public int getArg() | ||
| {return} | int | 参数值 | 
public function getArg()
{
    return $this->arg2 | ($this->arg1 << 8);
}
获取属性 arg 的值
| 
public void setArg(int $arg) | ||
| $arg | int | 参数值 | 
public function setArg($arg)
{
    $this->arg1 = ($arg >> 8) & 0xff;
    $this->arg2 = $arg & 0xff;
}
设置属性 arg 的值
留下一条评论吧!
请到论坛 登录 后刷新本页面!