简体   繁体   English

PHP推入多维数组

[英]PHP Push into array multidimensional

I'm trying to push some data into a multidimensional array, but can't find the correct syntax anywhere. 我正在尝试将一些数据推送到多维数组中,但无法在任何地方找到正确的语法。

array_push($price, $row["ShopID"], $row["URL"]);

This is my code so far, but this does not make the array multidimensional, it just inserts each item as an individual row in the array. 这是我的代码到目前为止,但是这不会使数组成为多维,它只是将每个项目作为数组中的单个行插入。 How can I fix this, and make the array multidimensional? 我该如何解决这个问题,并使数组成为多维的?

Are you pushing an array? 你在推阵吗? Then: 然后:

array_push($price, array($row["ShopID"], $row["URL"]));

or maybe: 或者可能:

 array_push($price, $row);

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

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