php array_combine 把array的默认键改成指定的字符串
array(2) {
[0] => array(6) {
[0] => string(1) "1"
[1] => string(10) "1470650276"
[2] => string(12) "测试人员"
[3] => string(9) "vpn出售"
[4] => string(20) "出售10个包月VPN"
[5] => string(6) "100000"
}
[1] => array(6) {
[0] => string(1) "2"
[1] => string(10) "1470650739"
[2] => string(12) "测试人员"
[3] => string(9) "服务器"
[4] => string(28) "双核CPU2G内存40SDD硬盘"
[5] => string(5) "15000"
}
}
改成
array(2) {
[0] => array(6) {
["record_id"] => string(1) "1"
["record_create_time"] => string(10) "1470650276"
["record_create_people"] => string(12) "测试人员"
["record_name"] => string(9) "vpn出售"
["record_comment"] => string(20) "出售10个包月VPN"
["record_money"] => string(6) "100000"
}
[1] => array(6) {
["record_id"] => string(1) "2"
["record_create_time"] => string(10) "1470650739"
["record_create_people"] => string(12) "测试人员"
["record_name"] => string(9) "服务器"
["record_comment"] => string(28) "双核CPU2G内存40SDD硬盘"
["record_money"] => string(5) "15000"
}
}
array_combine() 函数通过合并两个数组来创建一个新数组,其中的一个数组是键名,另一个数组的值为键值。
注释:键名数组和键值数组的元素个数必须相同!
如果其中一个数组为空,或者两个数组的元素个数不同,则该函数返回 false。
$key = array('a','b','c','d');
$array1 =array('0' => array('0'=>'first','1'=>'two','2'=>'hp','3'=>'aaa'),
'1' => array('0'=>'first','1'=>'two','2'=>'hp','3'=>'aaa'));
foreach($array1 as $kay=>$val ){
$array1[$kay] = array_combine($key,$val); }
var_dump($array1);
php array_combine 把array的默认键改成指定的字符串的更多相关文章
- Kendo Web UI Grid数据绑定,删除,编辑,并把默认英文改成中文
Kendo Web UI 是个不错的Jquery框.可惜老外写的,很多都是默认的英文,当然我们也可以设置成中文,接下来,我们就看看Grid是如何实现的数据绑定(Kendo Grid数据绑定实现有很多方 ...
- ubuntu将默认中文改成英文
找到/etc/default/locale下面的文件,使用vim打开 将看到内容为: LANG=”zh_CN.UTF-8″ LANGUAGE=”zh_CN:zh” 改为 LANG=”en_US.UTF ...
- <input type='file'/>把默认样式改成框框
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- debian将默认中文改成英文
$ sudo export LANG=en_US.UTF-8 $ sudo dpkg-reconfigure locales
- 利用CSS 修改input=radio的默认样式(改成选择框)
html部分: <input id="item2" type="radio" name="item"> <label fo ...
- python改成了python3的版本,那么这时候yum就出问题了
既然把默认python改成了python3的版本,那么这时候yum就出问题了,因为yum貌似不支持python3,开发了这个命令的老哥也不打算继续写支持python3的版本了,所以,如果和python ...
- 阿里云ECS服务器将默认的Ubuntu系统改成桌面版
以Ubuntu14.04 64位 为例 1.用自己PC登录阿里云,停止正在运行的实例 2.重装系统 更换系统盘->选择"公共镜像".Ubuntu. Ubuntu14.04 6 ...
- Android 打开方式选定后默认了改不回来?解决方法(三星s7为例)
Android 打开方式选定后默认了改不回来?解决方法(三星s7为例) 刚刚在测试东西,打开一个gif图,然后我故意选择用支付宝打开,然后...支付宝当然不支持,我觉得第二次打开它应该还会问我,没想到 ...
- wordpress文章链接怎么把默认的别名改成id形式和伪静态设置
别名默认是文章标题,打不开,改成英文形式可以打开,但这样很不方便,还有可能重复.怎么改成按文章id自动生成相应链接呢 找到设置---固定链接----把默认的日期和名称型改成自定义结构把末尾的%post ...
随机推荐
- Asp.Net 控件radio 的简单使用
js: <script type="text/javascript"> function ok() { document.getElementById("tx ...
- Activiti工作流学习-----基于5.19.0版本(8)
8.1.5 Start Event 继续上一篇的事件的分享笔记,Start Event指明该处是流程开始,至于开始事件的类型(消息到达开始,指定的事件循环开始等),定义如何开始是在开始事件圆圈图标里面 ...
- MTK手机最低亮度值修改教程,有效降低亮度[转]
感谢halflover的教程 反编译framework-res.apk 打开\framework-res\res\values\integers.xml 然后找到 <integer name=& ...
- Pick two points at random from the interior of a unit square, what is the expected distance between them?
My solution is as folllowing. This integration is hard to solve. I googled it, and found the result ...
- Ubuntu下配置使用maven
下载界面: http://maven.apache.org/download.cgi 当前下载:apache-maven-3.2.5-bin.zip 解压到:/usr/lib/jvm/apache-m ...
- Effective Java Item3:Enforce the singleton property with a private constructor or an enum type
Item3:Enforce the singleton property with a private constructor or an enum type 采用枚举类型(ENUM)实现单例模式. ...
- Android从相册读取图片
Uri originalUri = data.getData(); //获得图片的uri bm = MediaStore.Images.Media.getBitmap(resolver ...
- hdu 1385 Minimum Transport Cost
http://acm.hdu.edu.cn/showproblem.php?pid=1385 #include <cstdio> #include <cstring> #inc ...
- df 和du 命令统计磁盘空间不准确
Linux & Unix 中 df 和 du 命令统计磁盘空间数值不一致 经常会使用 df 和 du 分别查看磁盘空闲空间和占用空间,偶尔会发现 df(空闲空间) 会小于磁盘大小减去 du(占 ...
- phpcms:五、网站首页(index.html)
1.经典案例:图文列表:{pc:content action="position" posid="2" order="listorder DESC& ...