PHP中extract()函数的妙用
来源:互联网 发布:in图标是什么软件 编辑:程序博客网 时间:2024/06/01 14:24
近日在看博客时,看到一个非常好用的函数:extract(),它的主要作用是将数组展开,键名作为变量名,元素值为变量值,可以说为数组的操作提供了另外一个方便的工具,比方说,可以很方便的提取$_POST或者$_GET的元素,对表单提交上来的内容不能不用一一赋值,直接使用下面代码:
form.html
<form action="action.php" method="post">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit">
在action.php中只要使用extract()函数将$_POST全局数据解开:
action.php
<?php
extract($_POST);
//相当于$username = $_POST['username'];
//$password = $_POST['password'];
?>
阅读全文
0 0
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- PHP中extract()函数的妙用
- extract()函数的妙用
- php中一个神奇的函数extract
- PHP extract() 函数的用法
- php中compact,extract,list函数的使用
- php中rename()函数的妙用
- php中rename()函数的妙用
- php中rename()函数的妙用
- PHP中rename()函数的妙用
- php中rename()函数的妙用
- PHP extract() 函数
- [POJ1862]Stripies
- linux 命令全称
- Gulp开发:Gulp自动添加版本号
- Window配置gradle环境
- Android 6.0 运行时权限处理完全解析
- PHP中extract()函数的妙用
- 电吉他效果器音频处理(1)——失真效果器、超载失真效果器、移相效果器、弗兰格效果器
- 测试学习资料网址收藏大全
- iOS 单元测试和UI测试教程
- hibernate-1-基本配置
- python中模块名字和__name__属性
- 白盒测试工具
- win10 Cmake编译 深入理解Opencv 源码
- SVN报错:Previous operation has not finished; run 'cleanup' if it was interrupted