<?
php
class a{
public function news(
$news){
$articles =
array();
foreach (
$news as $key =>
$value) {
list(
$articles[
$key]['Title'],
$articles[
$key]['Description'],
$articles[
$key]['Url'],
$articles[
$key]['PicUrl'
]
) =
$value;
if(
$key >= 9)
break;
//最多只允许10条图文信息
}
$data['ArticleCount'] =
count(
$articles);
$data['Articles'] =
$articles;
return $data;
}
}
$arr=
array(
0=>
array("Title","Description","Url","PicUrl"
)
);
$a=
new a();
var_dump(
$a->news(
$arr));
转载于:https://www.cnblogs.com/hgj123/p/4653647.html