这是我的两个清单;
k = [[1, 2], [4], [5, 6, 2], [1, 2], [3], [4], [5,9]]
kDash = [[1, 2], [4], [5, 6, 2], [1, 2], [3], [4], [5,6], [1,2]]
Run Code Online (Sandbox Code Playgroud)
我的输出应该如下;
[[1, 2], [4], [5, 6, 2], [1, 2], [3], [4]]
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到这个输出?
先感谢您
我观看了 YouTube 视频并发现了这些代码。
我的 php 文件index.php
<?php
//initialize session
$ch = curl_init();
//set the URL
$url = "http://localhost:81/data.php"
//set options
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
//execution
$json=curl_exec($ch);
//close
curl_close($ch);
//decode the json
$json=json_decode($json, true);
//loop through the results
for($i=0;$i<['Metadata']['TotalResults'];$i++){
echo "JSON : <b>First Name = </b>". $json['Result'][$i]["FirstName"]." , <b>Last Name = </b>".$json['Result'][$i]["LastName"];
}
?>
Run Code Online (Sandbox Code Playgroud)
我的 json 文件 data.php
<?php
//metadata which will contain how many resukts we have
$meta_array['TotalResults'] = 1;
$metadata = '{"Metadata" : ';
$metadata …Run Code Online (Sandbox Code Playgroud)