Home > Backend Development > PHP Tutorial > PHP inserts cells at specified positions in multidimensional arrays

PHP inserts cells at specified positions in multidimensional arrays

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 09:08:49
Original
1209 people have browsed it

<code><span>protected</span><span><span>function</span><span>_getSellerMenuList</span><span>()</span> {</span><span>$menu_list</span> = <span>array</span>(
  <span>'goods'</span> => <span>array</span>(<span>'name'</span> => <span>'商品'</span>, <span>'child'</span> => <span>array</span>(
    <span>array</span>(<span>'name'</span> => <span>'商品发布'</span>, <span>'act'</span>=><span>'goods_add'</span>, <span>'op'</span>=><span>'index'</span>),
    <span>array</span>(<span>'name'</span> => <span>'淘宝导入'</span>, <span>'act'</span>=><span>'import'</span>, <span>'op'</span>=><span>'index'</span>),
    <span>array</span>(<span>'name'</span> => <span>'出售中的商品'</span>, <span>'act'</span>=><span>'online'</span>, <span>'op'</span>=><span>'index'</span>),
    <span>array</span>(<span>'name'</span> => <span>'仓库中的商品'</span>, <span>'act'</span>=><span>'offline'</span>, <span>'op'</span>=><span>'index'</span>),
    <span>array</span>(<span>'name'</span> => <span>'关联版式'</span>, <span>'act'</span>=><span>'store_plate'</span>, <span>'op'</span>=><span>'index'</span>),
    <span>array</span>(<span>'name'</span> => <span>'商品规格'</span>, <span>'act'</span> => <span>'spec'</span>, <span>'op'</span> => <span>'index'</span>),
    <span>array</span>(<span>'name'</span> => <span>'图片空间'</span>, <span>'act'</span>=><span>'album'</span>, <span>'op'</span>=><span>'album_cate'</span>),
 )),
 <span>'promotion'</span> => <span>array</span>(<span>'name'</span> => <span>'促销'</span>, <span>'child'</span> => <span>array</span>(
    <span>array</span>(<span>'name'</span> => <span>'抢购管理'</span>, <span>'act'</span>=><span>'groupbuy'</span>, <span>'op'</span>=><span>'index'</span>),
    <span>array</span>(<span>'name'</span> => <span>'代金券管理'</span>, <span>'act'</span>=><span>'voucher'</span>, <span>'op'</span>=><span>'list'</span>),
    <span>array</span>(<span>'name'</span> => <span>'活动管理'</span>, <span>'act'</span>=><span>'activity'</span>, <span>'op'</span>=><span>'activity'</span>),
    <span>array</span>(<span>'name'</span> => <span>'申请授权'</span>, <span>'act'</span> =><span>'accredit'</span>, <span>'op'</span>=><span>'list'</span>),
    <span>array</span>(<span>'name'</span> => <span>'会员管理'</span>, <span>'act'</span>=><span>'membercard'</span>, <span>'op'</span>=><span>'list'</span>)
 ))
);
<span>if</span> (!checkPlatformStore()) {
  <span>$points</span> = <span>array</span>(<span>'name'</span> => <span>'积分管理'</span>,<span>'act'</span>=><span>'points'</span>,<span>'op'</span>=><span>'index'</span>);
  <span>/*array_splice(array,start,lenght,array) 第四个参数使用数组的话
   用array再包一下,否则当字符串来识别,多维数组伤不起啊……/(ㄒoㄒ)/~~ */</span>
  array_splice(<span>$menu_list</span>[<span>'promotion'</span>][<span>'child'</span>],<span>2</span>,<span>0</span>,<span>array</span>(<span>$points</span>));
}
  <span>return</span><span>$menu_list</span>;
}</code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces PHP to insert cells at specified positions in multi-dimensional arrays, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
How to create an array within an array?
From 1970-01-01 08:00:00
0
0
0
php array
From 1970-01-01 08:00:00
0
0
0
Array to array
From 1970-01-01 08:00:00
0
0
0
php array rotation
From 1970-01-01 08:00:00
0
0
0
How to calculate the average of an array in PHP?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template