怎么得到return 的值,

WBOY
Release: 2016-06-13 11:55:33
Original
1409 people have browsed it

如何得到return 的值,急急急!!!

		public function huancheng($key)<br />		{<br />             $key="永兴村到山水人家";<br />             $str="";<br />		     $keys=explode('到',$key);<br />             $json = @file_get_contents("http://api.map.baidu.com/direction/v1?mode=transit&origin=".$keys[0]."&destination=".$keys[1]."&region=舟山&output=json&ak=gfPnxaaiPyNIhM7c3eZ1kmEL");<br />             $ar = json_decode($json,true);<br />             array_walk_recursive($ar, 'funv');<br />             function funv($v, $k) <br />			 {<br />			   global $str;<br />               if($k == 'stepInstruction') <br />			   {$str.= strip_tags($v);} <br />			 }<br />			 return $str;	<br />         }
Copy after login

怎么把两个函数分开,然后可以得到$str的返回值。
------解决方案--------------------
如果 funv 是作为类的方法出现的,则应
array_walk_recursive($ar, array($this, 'funv'));

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!