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?
基础教程推荐
- 在PHP中根据W3C规范Unicode 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
