如何通过PHP中的URL发送数组值? [英] how to send array values through url in PHP?
问题描述
如何在PHP中通过url发送数组?
how to send array through url in PHP?
我有一系列产品ID,我想通过url使用这些ID,因为这是我在其中工作的osCommerce所需要的,我该怎么做?
I have an array of product ids i want to use these id through url because this is the osCommerce needs it in which i am working in, how can i do it?
通常osCommerce要求插入单个产品,这反过来又给了我一个产品ID,我将其传递给url并将其放入购物车中,在该购物车中向我显示了此添加的产品,但是现在我在第一页中添加了多个产品具有不同的生成产品ID,我必须以相同的方式显示这些产品(一般显示),为此,我将在url中需要所有这些生成的ID
Generally osCommerce asks for the single product insertion which in turn gives me back a product id which i pass into the url and get it in shopping cart where i am shown this added product, but now i have multiple products added in first page with different generated product ids and i have to display these products the same way they are displayed in genaral, for which i will need all these generated ids here in url
推荐答案
您在寻找 http_build_query().
来自php.net的示例:
Example from php.net:
$data = array('foo'=>'bar',
'baz'=>'boom',
'cow'=>'milk',
'php'=>'hypertext processor');
echo http_build_query($data);
// foo=bar&baz=boom&cow=milk&php=hypertext+processor
echo http_build_query($data, '', '&');
// foo=bar&baz=boom&cow=milk&php=hypertext+processor
这篇关于如何通过PHP中的URL发送数组值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!