"$Xtext....",)$dafenleishu に書き込む方法=count( $Dhref);$xiaofenleishu=count($Xhref);for ($x=1;$x<=$da)"/> "$Xtext....",)$dafenleishu に書き込む方法=count( $Dhref);$xiaofenleishu=count($Xhref);for ($x=1;$x<=$da)">
ホームページ >バックエンド開発 >PHPチュートリアル >このような配列を作成する方法
このような配列を作成する方法
大カテゴリ ID に等しい対応する小カテゴリを subCats に書き込む方法
array(
id=>"$Xhref.. .. ",
name=>"$Xtext....",
)
$dafenleishu=count($Dhref);
$xiaofenleishu=count($Xhref) ;
for ($x=1;$xdcf18ca61346624eacfc8f6175cb3530"$Dhref[$x ]" ,
name=>"$Dtext[$x]",
subCats=>array()
);
}
$Dhref //大カテゴリID
$Dtext //大カテゴリ名
$Xhref //小カテゴリID
$XID_D //小カテゴリは大カテゴリIDに対応
$Xtext //小カテゴリ名
出力
<br />大分类ID<br />array(14) { [0]=> string(9) "sidengny." [1]=> string(9) "907362758" [2]=> string(9) "907362759" [3]=> string(9) "907362764" [4]=> string(9) "907362775" [5]=> string(9) "907362795" [6]=> string(9) "907362787" [7]=> string(9) "907362784" [8]=> string(9) "907363605" [9]=> string(9) "907363606" [10]=> string(9) "907363607" [11]=> string(9) "907363608" [12]=> string(9) "907363609" [13]=> string(9) "100563948" } <br /><br /><br />大分类名称<br />array(14) { [0]=> string(8) "所有宝贝" [1]=> string(8) "新品专区" [2]=> string(8) "保暖上装" [3]=> string(8) "保暖套装" [4]=> string(6) "保暖裤" [5]=> string(8) "内裤系列" [6]=> string(8) "袜类专区" [7]=> string(8) "背心-T恤" [8]=> string(8) "运动文胸" [9]=> string(8) "清仓专区" [10]=> string(8) "男士专区" [11]=> string(8) "女士专区" [12]=> string(8) "送礼专区" [13]=> string(8) "推荐分类" } <br /><br /><br /><br />小分类ID<br />array(37) { [0]=> string(9) "sidengny." [1]=> string(9) "sidengny." [2]=> string(9) "sidengny." [3]=> string(9) "sidengny." [4]=> string(9) "907362760" [5]=> string(9) "907362761" [6]=> string(9) "907362762" [7]=> string(9) "907362763" [8]=> string(9) "907362765" [9]=> string(9) "907362766" [10]=> string(9) "907362767" [11]=> string(9) "907362768" [12]=> string(9) "907362769" [13]=> string(9) "907362770" [14]=> string(9) "907362771" [15]=> string(9) "907362772" [16]=> string(9) "907419493" [17]=> string(9) "907362776" [18]=> string(9) "907362778" [19]=> string(9) "907362796" [20]=> string(9) "907362797" [21]=> string(9) "907362799" [22]=> string(9) "907363601" [23]=> string(9) "907363603" [24]=> string(9) "907363604" [25]=> string(9) "907362788" [26]=> string(9) "907362789" [27]=> string(9) "907362790" [28]=> string(9) "907362791" [29]=> string(9) "907362792" [30]=> string(9) "907362793" [31]=> string(9) "907362794" [32]=> string(9) "907362785" [33]=> string(9) "100563948" [34]=> string(9) "100563948" [35]=> string(9) "100563948" [36]=> string(9) "100563948" } <br /><br />对应上级大分类ID<br />array(37) { [0]=> string(9) "engny.tma" [1]=> string(9) "engny.tma" [2]=> string(9) "engny.tma" [3]=> string(9) "engny.tma" [4]=> string(9) "907362759" [5]=> string(9) "907362759" [6]=> string(9) "907362759" [7]=> string(9) "907362759" [8]=> string(9) "907362764" [9]=> string(9) "907362764" [10]=> string(9) "907362764" [11]=> string(9) "907362764" [12]=> string(9) "907362764" [13]=> string(9) "907362764" [14]=> string(9) "907362764" [15]=> string(9) "907362764" [16]=> string(9) "907362764" [17]=> string(9) "907362775" [18]=> string(9) "907362775" [19]=> string(9) "907362795" [20]=> string(9) "907362795" [21]=> string(9) "907362795" [22]=> string(9) "907362795" [23]=> string(9) "907362795" [24]=> string(9) "907362795" [25]=> string(9) "907362787" [26]=> string(9) "907362787" [27]=> string(9) "907362787" [28]=> string(9) "907362787" [29]=> string(9) "907362787" [30]=> string(9) "907362787" [31]=> string(9) "907362787" [32]=> string(9) "907362784" [33]=> string(9) "100563948" [34]=> string(9) "100563948" [35]=> string(9) "100563948" [36]=> string(9) "100563948" } <br /><br />小分类名称<br />array(37) { [0]=> string(6) "按综合" [1]=> string(6) "按销量" [2]=> string(6) "按新品" [3]=> string(6) "按价格" [4]=> string(16) "假两件(衬衫领)" [5]=> string(7) "V领上装" [6]=> string(8) "商务休闲" [7]=> string(8) "时尚居家" [8]=> string(8) "男士套装" [9]=> string(8) "女士套装" [10]=> string(12) "基础打底内衣" [11]=> string(8) "加绒加厚" [12]=> string(8) "全棉内衣" [13]=> string(8) "羊毛内衣" [14]=> string(8) "驼绒内衣" [15]=> string(8) "莱卡内衣" [16]=> string(6) "本命年" [17]=> string(10) "薄款打底裤" [18]=> string(8) "加绒加厚" [19]=> string(8) "男士内裤" [20]=> string(8) "女士内裤" [21]=> string(6) "平角裤" [22]=> string(8) "植物纤维" [23]=> string(6) "星期裤" [24]=> string(6) "礼盒装" [25]=> string(4) "棉袜" [26]=> string(4) "丝袜" [27]=> string(6) "全棉袜" [28]=> string(8) "精梳棉袜" [29]=> string(8) "春秋棉袜" [30]=> string(8) "夏季透气" [31]=> string(8) "冬季加厚" [32]=> string(12) "男士背心-T恤" [33]=> string(8) "热卖推荐" [34]=> string(8) "套装推荐" [35]=> string(10) "衬衫领推荐" [36]=> string(4) "内裤" } <br /><br /><br />