how to yii getPost for array _POST vars?(如何为数组_POST vars yii getPost?)
问题描述
假设我有
$_POST["x"]["y"] = 5;
我该怎么办
Yii::app()->request->getPost('x[y]');
如何通过索引检索 post 变量?是否有任何 yii 函数可以检查 sql 注入?getPost 会做那个检查吗?
how can i retrieve the post variable by index ? and is there any yii function that checks for sql injection ? does the getPost do that check ?
谢谢.
推荐答案
我对yii不熟悉,但是看了一下函数的源码https://github.com/yiisoft/yii/blob/1.1.12/框架/web/CHttpRequest.php
I am not familiar with yii, but looking at the source code for the function https://github.com/yiisoft/yii/blob/1.1.12/framework/web/CHttpRequest.php
你会这样做
$x = Yii::app()->request->getPost('x');
$y = $x['y'];
getPost 函数不会阻止 sql 注入.请阅读 http://www.yiiframework.com/wiki/275/how-to-write-secure-yii-applications/#hh11 有关保护 yii 应用程序的更多信息
The getPost function WILL NOT prevent sql injection. Please read http://www.yiiframework.com/wiki/275/how-to-write-secure-yii-applications/#hh11 for more information on securing your yii application
这篇关于如何为数组_POST vars yii getPost?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何为数组_POST vars yii getPost?
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
