Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我确信这很简单,但我无法在任何地方找到它:
如何更改这样的数组:
{ [0]=> string(3) "674" [1]=> string(3) "675" [2]=> string(3) "676" [3]=> string(3) "677" }
变成这样一个简单的:
(674,675,676,677)
用于另一个 SQL (IN) 查询?
我试过内爆,但失败了。
$myarray_value = implode( ',', $myarray );
您正在查看的是 JSON 格式,因此只需执行以下操作:
$string = '{ [0]=> string(3) "674" [1]=> string(3) "675" [2]=> string(3) "676" [3]=> string(3) "677" }'; $array = json_decode($string); print_r($array);