Home > Backend Development > PHP Tutorial > php中遇到的,这是什么,第一次遇到,怎样取其值???谢谢

php中遇到的,这是什么,第一次遇到,怎样取其值???谢谢

WBOY
Release: 2016-06-23 14:13:57
Original
769 people have browsed it

此数据从taobao系统里传来的,我要取其中的值,并存入数据库。
我怎样,取到title,num


回复讨论(解决方案)



不懂。。。。。。。。。

貌似多维数组。。。

echo {xx[items]->item}[0];[title]echo {xx[items]->item}[0][num];
Copy after login
Copy after login

不知道行不行 没测试过 瞎写的

echo {xx[items]->item}[0];[title]echo {xx[items]->item}[0][num];
Copy after login
Copy after login

不知道行不行 没测试过 瞎写的
echo {xx[items]->item}[0][title];echo {xx[items]->item}[0][num];
Copy after login

xx就是你接受的变量

try

foreach($arr['items']->item as $v){    echo $v->num. ' ' .$v->title."\n";}
Copy after login

假设你获取到的数组 叫 $arr

<?phpforeach ($arr['items'] as $k=> $v) {	$title = $v[0]['title'];	$num = $v[0]['num'];	//插入数据库}?>
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template