Heim >Backend-Entwicklung >PHP-Tutorial >PHP在多维数组指定位置插入单元

PHP在多维数组指定位置插入单元

WBOY
WBOYOriginal
2016-07-29 09:08:491180Durchsuche

<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>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了PHP在多维数组指定位置插入单元,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn