我想对数组使用 iconv 函数?
这是我的数组:
$array = array(
'name' => $burcname . ' Günlük yorumum',
'link' => 'http://apps.facebook.com/gunlukburcpaylas/sonuc.php?burc='. $burc,
'description' => $burcname . ' Günlük yorumu. Sizde her gün profilinizde günlük burç yorumunuz için uygulamaya katılın..',
'message' => $aciklama,
'picture' => $picture
);
iconv 为: $example = iconv('UTF-8','ISO-8859-9',$array);
但这是数组。并且不工作。我能做些什么?
this is my array:
$array = array(
'name' => $burcname . ' Günlük yorumum',
'link' => 'http://apps.facebook.com/gunlukburcpaylas/sonuc.php?burc='. $burc,
'description' => $burcname . ' Günlük yorumu. Sizde her gün profilinizde günlük burç yorumunuz için uygulamaya katılın..',
'message' => $aciklama,
'picture' => $picture
);
iconv as: $example = iconv('UTF-8','ISO-8859-9',$array);
But this is array. and dont work. What can i do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您将需要迭代数组内容,或使用诸如 array_walk 之类的函数。
Foreach 循环(未经测试)
在此示例中需要使用
array_keys
的原因是因为标准foreach
循环带有foreach($array对
或$value
所做的 $key => $value)foreach($array as $value)
修改不会被保留。使用
array_walk
(未经测试)如果您使用的是 PHP > 5.3 那么你可以使用 lambda 函数代替。
You will need to iterate the array contents, or use a function like
array_walk
.Foreach loop (untested)
The reason you need to use
array_keys
in this example is because a standardforeach
loop withforeach($array as $key => $value)
orforeach($array as $value)
modifications made to$value
are not preserved.Using
array_walk
(untested)If you are using PHP > 5.3 then you can use a lambda function instead.
array_walk_deep 函数(已测试)
array_walk_deep function (tested)
另一种解决方案是通过引用而不是通过值返回 foreach 的结果:
值变量前面的“&”允许您使用实际的数组值而不是副本。 :)
Another solution would be to return the results from the foreach by reference instead of by value:
The '&' in front of the value variable lets you use the actual array value instead of a copy. :)