arrays - 如何使用 Arr::only 助手重命名数组的键?
问题描述
我Arr::only
用来通过键从数组中获取值,但是我需要重命名ShortDesc
键以使用蛇案例而不是骆驼案例。这是可能的Arr::only
还是我需要使用array_map?
这是我的精彩代码。
$myArray = Arr::only($targetArray, ["title", "shortDesc"]);
解决方案
看代码:https ://github.com/illuminate/support/blob/master/Arr.php#L367
不,仅使用 Arr::only 函数是不可能实现您需要的。你还需要一些。
推荐阅读
- java - 如何从 Usb 令牌中读取证书以使用 java 进行数字签名
- android - 从服务器解码字节,然后使用 Mediacodec 在 SurfaceView 或某些播放器上渲染它
- java - 我如何使用正则表达式来实现包含功能?
- ffmpeg - 如何将 flv 转换为 mp4/mkv?
- visual-studio-2010 - 如何在 VB 2010 中读取文本文档中一行的特定部分?
- keras - 如何使用 SimpleRNN 建模模函数并预测多对多序列
- boolean - 使用 if else 和 notEmpty() 在 OCL 中计算
- nginx - 阻止 nginx 解码 URL
- python - argparse 默认作为函数总是被调用
- c# - 使用特定的盐生成密码