Home  >  Article  >  Backend Development  >  关于PHP Warning: implode(): Invalid arguments passed in报错问题

关于PHP Warning: implode(): Invalid arguments passed in报错问题

WBOY
WBOYOriginal
2016-06-23 13:49:082013browse

 $gets = "";      //下面($vv["get"]是类似array("del"=>"0","dept"=>"2") 这样的数组	  foreach($vv["get"] as $g => $gv)	  {	   $gets[] = $g."=".$gv;	  }		  $gets = implode("&",$gets);                   //这里的implode函数报错


百度翻译:    PHP警告:implode():无效的参数传递

求大神怎么解决???


回复讨论(解决方案)

在那句前面 var_dump($gets); 看是什么

$vv["get"] = array("del"=>"0","dept"=>"2");$gets = "";foreach($vv["get"] as $g => $gv){  $gets[] = $g."=".$gv;}     $gets = implode("&",$gets); echo $gets;
del=0&dept=2
没有问题

但最好是用 http_build_query 函数
$gets = http_build_query($vv['get']);

在那句前面 var_dump($gets); 看是什么



还是一样报错 看不了。。。

要转成数组,不是应该用explode 吗?implode是数组转字符串吧~~

看错了 

在那句前面 var_dump($gets); 看是什么



有了 得到这个 PHP Fatal error:  Can't use function return value in write context in 

把你的代码贴全了

把你的代码贴全了



@xuzuning  版主根据你上面的方法可以显示了   谢谢了 

你的 $vv["get"]  这个变量里肯定有问题

你的 $vv["get"]  这个变量里肯定有问题



恩恩 可惜 改原句我不会改
Statement:
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