本文整理汇总了PHP中REST::put方法的典型用法代码示例。如果您正苦于以下问题:PHP REST::put方法的具体用法?PHP REST::put怎么用?PHP REST::put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类REST
的用法示例。
在下文中一共展示了REST::put方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_all_fields
/**
* Perform a remote update request using the REST "put" method.
* Note that this method will update *all* this model object's fields
* that are included in this model object's data array - see fields().
* You can override this by providing an arg list of fields to update.
*
* @return Remote this object for method chaining, or NULL on failure
*/
public function update_all_fields()
{
if (!is_object($this->object)) {
return NULL;
}
if (!$this->object->id) {
return NULL;
}
if (!$this->is_validated()) {
return NULL;
}
$fields = func_get_args();
$count = count($fields);
if ($count == 0) {
$fields = $this->fields();
} elseif ($count == 1 && is_array($fields[0])) {
$fields = $fields[0];
}
$fields[] = $this->object->get_id_field();
// can't update without
$url = $this->secure_url() . '/' . $this->object->id;
$data = array($this->get_class() => $this->object->data($fields));
$data[self::DB] = $this->get_database();
if ($this->response = REST::put($url, $data, $this->type)) {
$this->check_response();
}
$this->object->changed = array();
return $this;
}