您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

请大家帮忙看看有关问题

2024/2/25 16:35:40发布20次查看
请大家帮忙看看问题
程序是要输入两个json格式的txt文件,然后通过匹配两个文件的相同的index,然后输出一个新的json格式的txt文件。 比如:
这是输入的两个文件的格式:
1. product
{
  product_name: string   // a unique id for the product
  manufacturer: string
  family: string         // optional grouping of products
  model: string
  announced-date: string // iso-8601 formatted date string, e.g. 2011-04-28t19:00:00.000-05:00
}
2. listing
{
  title: string         // description of product for sale
  manufacturer:  string // who manufactures the product for sale
  currency: string      // currency code, e.g. usd, cad, gbp, etc.
  price: string         // price, e.g. 19.99, 100.00
}
输出的文件格式为:
{
  product_name: string
  listings: array[listing]
}
先上代码:
baseitem.php
buildfromarray($fields);
}
/**
* @param array $fields
*/
abstract public function buildfromarray(array $fields);
/**
* @return array
*/
abstract public function converttoarray();
}
?>
listing.php
$this->title,
            'manufacturer' => $this->manufacturer,
            'currency' => $this->currency,
            'price' => $this->price,
        );
    }
/**
     * @inheritdoc
     */
    public function buildfromarray(array $fields)
    {
        $this->title = $fields['title'];
        $this->manufacturer = $fields['manufacturer'];

该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product