cakephp 获取、设置表单值学习笔记
cakephp中,不允许直接修改$this->request->data
但是可以用下面的方式设置
代码如下 | 复制代码 |
//取值 $this->request->data('Post.title'); //设置新值到data中 $this->request->data('Post.title', 'New post!'); |
/**
* Provides a read/write accessor for `$this->data`. Allows you
* to use a syntax similar to `CakeSession` for reading post data.
*
* ## Reading values.
*
* `$request->data('Post.title');`
*
* When reading values you will get `null` for keys/values that do not exist.
*
* ## Writing values
*
* `$request->data('Post.title', 'New post!');`
*
* You can write to any value, even paths/keys that do not exist, and the arrays
* will be created for you.
*
* @param string $name,... Dot separated name of the value to read/write
* @return mixed Either the value being read, or this so you can chain consecutive writes.
*/
您可能感兴趣的文章:
Jquery 基础学习笔记
JQuery 学习笔记 element属性控制
jquery学习笔记二 实现可编辑的表格
基于jQuery的简单的列表导航菜单
jQuery学习笔记[1] jQuery中的DOM操作
jQuery学习笔记之jQuery的DOM操作
jQuery学习笔记 操作jQuery对象 属性处理
jquery学习笔记
jQuery学习笔记之jQuery的动画
c# 画曲线图与折线图的代码