简体   繁体   English

如何在 php 中从 minicart.js 获取项目

[英]How ot get items from minicart.js in php

I am working on minicart.js .我正在研究minicart.js I want to get the itmes of minicat in php but unable to do so.我想在 php 中获取 minicat 的项目,但无法这样做。 minicart.js have builtin function paypal.minicart.cart.items() which return the arrays of items. minicart.js 有内置函数paypal.minicart.cart.items()返回项目数组。 How to get array of items in php so I can save these items to database and further use.如何在 php 中获取项目数组,以便我可以将这些项目保存到数据库并进一步使用。

<script> paypal.minicart.cart.items().forEach( console.log.bind(console)); </script>

first thing you need to change "action:" in minicart.js from paypal link to post.php make file post.php type this code inside it您需要将 minicart.js 中的“action:”从 paypal 链接更改为 post.php 制作文件 post.php 在其中键入此代码

foreach ($_POST as $key => $value) {
echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM