【问题标题】:Trying to save a form array data using cakephp 2.0尝试使用 cakephp 2.0 保存表单数组数据
【发布时间】:2015-06-04 19:01:22
【问题描述】:
Array
(
    [submit] => Save
    [PeachesProduct] => Array
        (
            [pro_category_id] => 1
            [pro_title] => qeqqe
            [pro_desc] => add
            [pro_quan] => 313
            [pro_price] => 12
            [pro_ship_days] => 21
            [pro_status] => A
        )

    [PeachesProductDetail] => Array
        (
            [size] => Array
                (
                    [0] => 12
                    [1] => 12
                    [2] => 13
                    [3] => 12
                )

            [price] => Array
                (
                    [0] => 21323
                    [1] => 21323
                    [2] => 21323
                    [3] => 313
                )

        )

)

【问题讨论】:

  • 你想达到什么目的?您当前代码中的哪些内容未按预期工作?

标签: arrays save cakephp-2.0


【解决方案1】:
if($this->request->data) {
    if(this->PeachesProduct->saveAll($this->request->data, array('deep' => true))) {
        // saved do somthing
    }
}

【讨论】:

    猜你喜欢
    • 2013-01-12
    • 2015-08-25
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    • 2012-07-18
    • 2014-04-26
    • 2019-09-20
    • 2023-03-28
    相关资源
    最近更新 更多