本文整理匯總了PHP中UrlManager::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP UrlManager::update方法的具體用法?PHP UrlManager::update怎麽用?PHP UrlManager::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UrlManager
的用法示例。
在下文中一共展示了UrlManager::update方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: intval
$url_array = $form->getSubmitValues();
$url = Security::remove_XSS($url_array['url']);
$description = Security::remove_XSS($url_array['description']);
$active = intval($url_array['active']);
$url_id = $url_array['id'];
$url_to_go = 'access_urls.php';
if ($url_id != '') {
//we can't change the status of the url with id=1
if ($url_id == 1) {
$active = 1;
}
//checking url
if (substr($url, strlen($url) - 1, strlen($url)) == '/') {
UrlManager::update($url_id, $url, $description, $active);
} else {
UrlManager::update($url_id, $url . '/', $description, $active);
}
// URL Images
$url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
$image_fields = array("url_image_1", "url_image_2", "url_image_3");
foreach ($image_fields as $image_field) {
if ($_FILES[$image_field]['error'] == 0) {
// Hardcoded: only PNG files allowed
if (end(explode('.', $_FILES[$image_field]['name'])) == 'png') {
if (file_exists($url_images_dir . $url_id . '_' . $image_field . '.png')) {
// if the file exists, we have to remove it before move_uploaded_file
unlink($url_images_dir . $url_id . '_' . $image_field . '.png');
}
move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png');
}
// else fail silently