2013-05-28 20 views

回答

1

這是豆莢用() - >保存() - 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); 

也可被添加() - http://pods.io/docs/add/

+0

你如何保存多重關係?比如兩個「作者」? $ pod-> save('author',array(1,2))不起作用。 – Bakaburg

+0

只要作者是一個多重選擇限制爲2+(或無限制),傳遞數組應該工作。我們也支持'1,2'逗號分隔值。 –