本文整理匯總了PHP中post::edit方法的典型用法代碼示例。如果您正苦於以下問題:PHP post::edit方法的具體用法?PHP post::edit怎麽用?PHP post::edit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類post
的用法示例。
在下文中一共展示了post::edit方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: extract
$object_name = 'dbh_post';
require 'components/create_form_data.php';
extract($arr_form_data);
if ($_POST['btn_cancel']) {
log_action('Pressed cancel button', $_SERVER['PHP_SELF']);
redirect("listview_post.php?{$query_string}");
}
if ($_POST['btn_submit']) {
log_action('Pressed submit button', $_SERVER['PHP_SELF']);
$file_upload_control_name = 'attach_file';
require 'components/upload_generic.php';
$message .= $dbh_post->sanitize($arr_form_data)->lst_error;
extract($arr_form_data);
if ($dbh_post->check_uniqueness_for_editing($arr_form_data)->is_unique) {
//Good, no duplicate in database
} else {
$message = "Record already exists with the same primary identifiers!";
}
if ($message == "") {
$dbh_post->edit($arr_form_data);
redirect("listview_post.php?{$query_string}");
}
}
}
require 'subclasses/post_html.php';
$html = new post_html();
$html->draw_header('Edit Post', $message, $message_type, TRUE, TRUE);
$html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc);
$html->draw_hidden('id');
$html->draw_controls('edit');
$html->draw_footer();
示例2: array
$arrData = array();
$arrData['name'] = addslashes(ucwords($_POST['name']));
$arrData['details'] = addslashes($_POST['details']);
$arrData['status'] = addslashes($_POST['status']);
$arrData['category'] = addslashes($_POST['category']);
if (empty($_POST['id'])) {
$arrData['user_id'] = $user_id;
$arrData['added_date'] = date('Y-m-d H:i:s');
$insert = $post->add($arrData);
if ($insert) {
$cover = '';
if ($_FILES['image']['name'] != '') {
$cover = 'post_' . $insert . '.jpg';
saveResizeImage($_FILES['image'], $insert, 'post');
}
$_SESSION['insert_post'] = 'added';
} else {
$_SESSION['insert_post'] = 'insert_faild';
}
} else {
$arrData['id'] = $_POST['id'];
// $arrData['post'] = 'post_' . $_POST['id'] . '.jpg';
if ($_FILES['image']['name'] != '') {
$cover = 'post_' . $arrData['id'] . '.jpg';
saveResizeImage($_FILES['image'], $arrData['id'], 'post');
}
$update = $post->edit($arrData);
$_SESSION['insert_post'] = 'updated';
}
}
header('Location: post.php?act=' . $_SESSION['insert_post']);