我有简单的数组
$a = ['a', '', 'b','c','d'];
如果我json_encode它我会有
["a","","b","c","d"]
但是,如果我尝试使用array_filter或array_diff删除空值
我会有
{"0":"a","2":"b","3":"c","4":"d"}
但我不需要对数组键进行编码,我需要一个没有空元素且没有数组键的编码数组,如何解决?
PHP沙箱示例:http ://sandbox.onlinephpfunctions.com/code/91635a5df7fcd954dd64fe92089f2beadc81c3c4