如何只回显数组中的一个值?

时间:2018-10-26 03:06:43

标签: php arrays

我只想使用json api中数组中的一个值。

PHP:

@Entity
@Table(name = "order_items")
@DiscriminatorColumn(name = "item_type", discriminatorType = DiscriminatorType.STRING)
public abstract class BaseOrderItem extends BasePersistable {

@ManyToOne
@JoinColumn(name = "product_id")
private Product product;

@ManyToOne
@JoinColumn(name = "product_package_id")
private ProductPackage originalPackage;
@ManyToOne
@JoinColumn(name = "life_science_id")
private LifeScienceProduct lifeScienceProduct;

@ManyToOne
@JoinColumn(name = "lab_consumable_id")
private LabConsumable labConsumable;

@ManyToOne
@JoinColumn(name = "bioreagent_id")
private Bioreagent bioreagent;

//Price and currency can be null for people shopping in countries where no
//price is defined.
@ManyToOne
@JoinColumn(name = "currency_id")
private Currency currency;
private BigDecimal unitPrice;
//If the currency the user is shopping in is different then the suppliers
//currency we want to save their price at time of order creation.
@ManyToOne()
@JoinColumn(name = "supplier_currency_id")
private Currency supplierUnitCurrency;
private BigDecimal supplierUnitPrice;

/**
 * Used for items that are priced from a table, where quantity determines
 * the total price and not individual unitPrice.
 */
private BigDecimal totalPrice;
private boolean priceOverridden = false;
@NotNull
private Long quantity;
@NotNull
private String unit;
@NotNull
private BigDecimal unitSize;
@ManyToOne
@JoinColumn(name = "country_id")
private Country country;
private String itemNumber;
private String internalItemNumber;
private BigDecimal labNetworkCost;
private String labNetworkCostCurrencyCode;
private String labNetworkCostCurrencySymbol;
private String unitDescription;

private boolean internalOrderItem = false;

@Column(name = "quote_response_id")
private Integer quoteResponseId;
@OneToOne
@JoinColumn(name = "quote_response_id", updatable = false, insertable = false)
private QuoteSupplierResponse quoteResponse;

@ManyToMany
@JoinTable(name = "order_items_discounts",
        joinColumns = @JoinColumn(name = "order_item_id"),
        inverseJoinColumns = @JoinColumn(name = "discount_id"))
private List<Discount> discounts = new ArrayList<>();

@ManyToMany()
@JoinTable(name = "order_item_inventory",
        joinColumns = @JoinColumn(name = "order_item_id"),
        inverseJoinColumns = @JoinColumn(name = "product_inventory_id"))
private List<ProductInventory> inventory = new ArrayList<>();

@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinTable(name = "order_item_mk_inventory",
        joinColumns = @JoinColumn(name = "order_items_id"),
        inverseJoinColumns = @JoinColumn(name = "mk_inventory_id"))
private List<MkInventory> mkInventories = new ArrayList<>();

private String status;

@Enumerated(EnumType.STRING)
private OrderTypeDivision orderTypeDivision;

private Integer shipTime;

@Column(name = "quote_response_package_id")
private Long quoteResponsePackageId;

private Boolean lnQcEnable;

@Enumerated(EnumType.STRING)
private QuoteCategory quoteCategory;

@OneToOne(orphanRemoval = true)
@JoinTable(name = "order_item_external_product",
        joinColumns = @JoinColumn(name = "orderItemId"),
        inverseJoinColumns = @JoinColumn(name = "externalProductId"))
private ExternalProducts externalProducts;

private Integer supplierCompanyId;
private String productName;
private String productNameCn;
private String supplierProductId;
private String cas;
private String mdl;
private String purity;
}

结果:

<?php
  $url="my_url";
  $result = file_get_contents($url);
  echo $result;
?>

我只能回声湿度值吗?

0 个答案:

没有答案