教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 cakephp 获取、设置表单值学习笔记

cakephp 获取、设置表单值学习笔记

发布时间:2023-05-10   编辑:jiaochengji.com
教程集为您提供cakephp 获取、设置表单值学习笔记等资源,欢迎您收藏本站,我们将为您提供最新的cakephp 获取、设置表单值学习笔记资源
文章给大家提供一篇cakephp 获取、设置表单值学习笔记,希望此文章对大家学习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# 画曲线图与折线图的代码

[关闭]
~ ~