Problem bei der Array-Neuzuordnung
WWK
WWK 2019-07-12 18:42:51
0
1
912
[
  'play'=>
  [
     "qq",
     "iqiyi",
     "sohu",
     "youku"
     "mgtv",
  ],
  'url'=>
  [
    "1$http://v.qq.com/x/cover/llws99784lrtpz7/g003189nkf3.html",
    "1$http://www.iqiyi.com/v_19rse7ldt0.html",
    "1$http://tv.sohu.com/v/MjAxOTA2MjUvbjYwMDczMDI0MS5zaHRtbA==.html",
    "1$http://v.youku.com/v_show/id_XNDI0Mjg3NDcyOA==.html",
    "1$http://www.mgtv.com/b/330256/5878154.html",
  ]
]

So ordnet man das obige Array in die folgende Form zu:

[
	[
	'play'=>'qq',
	'url'=>'1$http://v.qq.com/x/cover/llws99784lrtpz7/g003189nkf3.html',	
	],
	[
	'play'=>'iqiyi',
	'url'=>'1$http://www.iqiyi.com/v_19rse7ldt0.html',	
	],
	[
	'play'=>'sohu',
	'url'=>'1$http://tv.sohu.com/v/MjAxOTA2MjUvbjYwMDczMDI0MS5zaHRtbA==.html',	
	],
	[
	'play'=>'youku',
	'url'=>'1$http://v.youku.com/v_show/id_XNDI0Mjg3NDcyOA==.html',	
	],
	[
	'play'=>'mgtv',
	'url'=>'1$http://www.mgtv.com/b/330256/5878154.html',	
	],
]

Neuling Zu wenig tatsächliche Übung. Ich hoffe, der alte Vogel kann antworten

WWK
WWK

Antworte allen(1)
angryTom
<?php
header("Content-type:text/html;charset=utf-8");
$array1 = [
'play'=>
[
"qq",
"iqiyi",
"sohu",
"youku",
"mgtv",
],
'url'=>
[
"http://v.qq.com/x/cover/llws99784lrtpz7/g003189nkf3.html",
"http://www.iqiyi.com/v_19rse7ldt0.html",
"http://tv.sohu.com/v/MjAxOTA2MjUvbjYwMDczMDI0MS5zaHRtbA==.html",
"http://v.youku.com/v_show/id_XNDI0Mjg3NDcyOA==.html",
"http://www.mgtv.com/b/330256/5878154.html",
]
];
$i = 0;
$newarr = array();
foreach($array1['play'] as $val){
$newarr[$i]['play'] = $array1['play']['$i'];
$newarr[$i]['url'] = $array1['url'][$i];
$i++;
}
var_dump($newarr);

无标题.png

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!