本文整理匯總了PHP中tree::mv方法的典型用法代碼示例。如果您正苦於以下問題:PHP tree::mv方法的具體用法?PHP tree::mv怎麽用?PHP tree::mv使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tree
的用法示例。
在下文中一共展示了tree::mv方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isset
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
$temp = $fs->mk($node, isset($_GET['position']) ? (int) $_GET['position'] : 0, array('nm' => isset($_GET['text']) ? $_GET['text'] : 'New node'));
$rslt = array('id' => $temp);
break;
case 'rename_node':
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
$rslt = $fs->rn($node, array('nm' => isset($_GET['text']) ? $_GET['text'] : 'Renamed node'));
break;
case 'delete_node':
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
$rslt = $fs->rm($node);
break;
case 'move_node':
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
$parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? (int) $_GET['parent'] : 0;
$rslt = $fs->mv($node, $parn, isset($_GET['position']) ? (int) $_GET['position'] : 0);
break;
case 'copy_node':
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
$parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? (int) $_GET['parent'] : 0;
$rslt = $fs->cp($node, $parn, isset($_GET['position']) ? (int) $_GET['position'] : 0);
break;
default:
throw new Exception('Unsupported operation: ' . $_GET['operation']);
break;
}
header('Content-Type: application/json; charset=utf-8');
echo json_encode($rslt);
} catch (Exception $e) {
header($_SERVER["SERVER_PROTOCOL"] . ' 500 Server Error');
header('Status: 500 Server Error');