带键值的数组推送
如何使用 => 添加值$key
到一个数组中,例如:
$images = array();
array_push($images, $_FILES['file']['tmp_name'] => $_FILES['file']['name']);
所以数组会像:
array('temporary_file_name' => 'file_name.zip');
但我的 IDE 说它无效并且无法工作。
How do you add an value with an => $key
into an array, for example:
$images = array();
array_push($images, $_FILES['file']['tmp_name'] => $_FILES['file']['name']);
So the array would be like:
array('temporary_file_name' => 'file_name.zip');
But my IDE says it's invalid and would not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想这就是你想要的:
I think this is what you want:
请参阅:[由 Mod 删除]http://stackoverflow.com/questions/5017747/need-a-function-array-push-with-keys[/由 Mod 删除],您可以构建一个漂亮且动态的多数组函数有了这个解决方案,我确信。
编辑:...好吧...继续这个然后...:
See : [removed by Mod's]http://stackoverflow.com/questions/5017747/need-a-function-array-push-with-keys[/removed by Mod's] and you could build a nice and dynamic multi-array function with that solution, I'm sure.
Edit: ... well ... go ahead with this then ...: