$link = $_SERVER['PHP_SELF'];
$link_array = explode('/u/', $link);
echo $_COOKIE[] = end($link_array);
有人知道我该如何删除4个字符,或者完全不同的方法。
答案 0 :(得分:1)
使用基本名称功能
mostSellingProducts: async (_,{},ctx)=>{
const Products = await invoice.aggregate([
{ $unwind: "$Saledetail" },
{ $match: { "state" : 'PAID'}},
{ $group: {
_id : "$Saledetail.id",
total: { $sum: '$Saledetail.totalline' }
}},
{
$lookup: {
from: 'dhproducts',
localField: '_id',
foreignField: "_id",
as: "producto"
}
},
{
$limit: 4
},
{
$sort : {total: -1}
}
]);
console.log(Products);
return Products;
},