0

大家好,

我知道如何在 podscms 的帮助下获取记录,但我想更新 podscms 获取的记录。喜欢

$somePod = pods('somepod')->update($my_array);

大家有什么建议,

4

1 回答 1

1

这在 pods()->save() 中可用 - http://pods.io/docs/save/

<?php
// Get the book item with an ID of 5
$pod = pods( 'book', 5 );

// Set the author (a user relationship field)
// to a user with an ID of 2
$pod->save( 'author', 2 );

// Set a group of fields to specific values
$data = array(
    'name' => 'New book name',
    'author' => 2,
    'description' => 'Awesome book, read worthy!'
);

// Save the data as set above
$pod->save( $data );

// Or the shorthand
$id = pods( 'yourpod', $id )->save( $data );

也可以使用 add() - http://pods.io/docs/add/

于 2013-05-28T14:04:02.523 回答