0
您好所有,如何在PODSCMS的幫助下更新數據?
我知道如何與podscms, 的幫助下獲取記錄,但我想更新由podscms獲取的記錄。 像
$somePod = pods('somepod')->update($my_array);
任何人有一些建議,
您好所有,如何在PODSCMS的幫助下更新數據?
我知道如何與podscms, 的幫助下獲取記錄,但我想更新由podscms獲取的記錄。 像
$somePod = pods('somepod')->update($my_array);
任何人有一些建議,
這是豆莢用() - >保存() - 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/
你如何保存多重關係?比如兩個「作者」? $ pod-> save('author',array(1,2))不起作用。 – Bakaburg
只要作者是一個多重選擇限制爲2+(或無限制),傳遞數組應該工作。我們也支持'1,2'逗號分隔值。 –