本文整理匯總了PHP中Reference::upload方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reference::upload方法的具體用法?PHP Reference::upload怎麽用?PHP Reference::upload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Reference
的用法示例。
在下文中一共展示了Reference::upload方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit
function edit()
{
$sql = '
UPDATE {{reference}}
SET
parent=' . trim($_POST['parent']) . ',
name=\'' . trim($_POST['name']) . '\',
path=\'' . trim($_POST['path']) . '\',
value=\'' . trim($_POST[$_POST['type']]) . '\',
type=\'' . trim($_POST['type']) . '\'
WHERE id=' . $_POST['id'] . '
';
DB::exec($sql);
$addingSql = '';
if (count($_POST['fileIds']) > 0) {
$addingSql = ' AND id NOT IN (' . implode(',', $_POST['fileIds']) . ') ';
}
$sql = '
SELECT path FROM {{reference_files}}
WHERE reference=' . $_POST['id'] . ' ' . $addingSql . '
';
$delFiles = DB::getAll($sql, 'path');
foreach ($delFiles as $item) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $item)) {
unlink($_SERVER['DOCUMENT_ROOT'] . $item);
}
}
$dir = md5('touch' . $user);
$dir = '/u/files/reference/' . $_POST['id'] . '/';
if (is_dir($_SERVER['DOCUMENT_ROOT'] . $dir)) {
if (count(scandir($_SERVER['DOCUMENT_ROOT'] . $dir)) == 2) {
rmdir($_SERVER['DOCUMENT_ROOT'] . $dir);
}
}
$sql = '
DELETE FROM {{reference_files}}
WHERE reference=' . $_POST['id'] . ' ' . $addingSql . '
';
DB::exec($sql);
Reference::upload($_POST['id']);
}