Xcom::decode
Xcom::getDebugOutput
Xcom
PHP Manual

# Xcom::encode

(PECL xcommerce >= 1.0.0)

Xcom::encode — Encode an avro message

### Opis

public string Xcom::encode ( stdClass `$data` , string `$avro_schema` )

This method encodes a `stdClass` object to an avro binary encoded blob.

### Parametry

`data`

  A `stdClass` compatible object to encode.

`avro_schema`

  The avro JSON schema to encode the `data` against.

### Zwracane wartości

Returns an avro-encoded string or `FALSE` on failure.

### Przykłady

Przykład #1 Xcom::encode() example

`<?php
$data = new stdClass();
$data->orderID = "foo1234";
$schema = file_get_contents('http://api.x.com/ocl/com.x.example.v1/OrderFulfillment/OrderShipped/1.2.0/');
$xcom = new Xcom();
$xcom->encode($data, $schema);
?>`

### Zobacz też:

- Xcom::decode() - Decodes an avro message

Xcom::decode
Xcom::getDebugOutput
Xcom
PHP Manual