我正在使用 Google Sheets v4 API,并且想使用 Google Sheets UI 上提供的橙色 FF9900,但 API 中的 RGBA 不遵循标准颜色 RGBA。从这个工具中,我得到橙色的 rgba(236, 161, 51, 1)。
这是我使用 Google API Explorer 的请求代码:
{
requests: [{
repeatCell: {
range:{
sheetId: correctsheetid,
startRowIndex: 2,
endRowIndex: 3,
},
cell:{
userEnteredFormat:{
backgroundColor: {
red: 236,
green: 161,
blue: 51
}
}
},
fields: 'userEnteredFormat(backgroundColor)'
}
}]
}
Run Code Online (Sandbox Code Playgroud)
但是,工作表上的输出是蓝色的,而不是预期的橙色。
我正在制作一个插件,它将更新woocommerce的库存量,这是某种第三方购物车,我想将woocommerce的量与其他网站数据进行同步。我的代码是
$quantity = floatval(5);
$product_id = 10;
$woocmmerce_instance = new WC_Product( $product_id );
$woocmmerce_instance->set_stock_quantity($quantity);
Run Code Online (Sandbox Code Playgroud)
但这会引发错误PHP致命错误:调用未定义的方法WC_Product :: set_stock_quantity()