本文整理匯總了PHP中load::redirect方法的典型用法代碼示例。如果您正苦於以下問題:PHP load::redirect方法的具體用法?PHP load::redirect怎麽用?PHP load::redirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類load
的用法示例。
在下文中一共展示了load::redirect方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Routes requests and sets return data
*/
public function __construct()
{
if (class_exists('mvc')) {
mvc::$view = '#moadmin';
}
$this->mongo['dbs'] = self::$model->listDbs();
if (isset($_GET['db'])) {
if (strpos($_GET['db'], '.') !== false) {
$_GET['db'] = $_GET['newdb'];
}
self::$model->setDb($_GET['db']);
}
if (isset($_POST['limit'])) {
$_SESSION['limit'] = (int) $_POST['limit'];
} else {
if (!isset($_SESSION['limit'])) {
$_SESSION['limit'] = OBJECT_LIMIT;
}
}
if (isset($_FILES['import']) && is_uploaded_file($_FILES['import']['tmp_name']) && isset($_GET['collection'])) {
$data = json_decode(file_get_contents($_FILES['import']['tmp_name']));
self::$model->import($_GET['collection'], $data, $_POST['importmethod']);
}
$action = isset($_GET['action']) ? $_GET['action'] : 'listCollections';
if (isset($_POST['object'])) {
if (self::$model->saveObject($_GET['collection'], $_POST['object'])) {
return $this->_dumpFormVals();
} else {
$action = 'editObject';
$_POST['errors']['object'] = 'Error: object could not be saved - check your array syntax.';
}
} else {
if ($action == 'createCollection') {
self::$model->{$action}($_GET['collection']);
} else {
if ($action == 'renameCollection' && isset($_POST['collectionto']) && $_POST['collectionto'] != $_POST['collectionfrom']) {
self::$model->{$action}($_POST['collectionfrom'], $_POST['collectionto']);
$_GET['collection'] = $_POST['collectionto'];
$action = 'listRows';
}
}
}
if (isset($_GET['sort'])) {
self::$model->sort = array($_GET['sort'] => $_GET['sortdir']);
}
$this->mongo['listCollections'] = self::$model->listCollections();
if ($action == 'editObject') {
$this->mongo[$action] = isset($_GET['_id']) ? self::$model->{$action}($_GET['collection'], $_GET['_id'], $_GET['idtype']) : '';
return;
} else {
if ($action == 'removeObject') {
self::$model->{$action}($_GET['collection'], $_GET['_id'], $_GET['idtype']);
return $this->_dumpFormVals();
} else {
if ($action == 'ensureIndex') {
foreach ($_GET['index'] as $key => $field) {
$indexes[$field] = isset($_GET['isdescending'][$key]) && $_GET['isdescending'][$key] ? -1 : 1;
}
self::$model->{$action}($_GET['collection'], $indexes, $_GET['unique'] == 'Unique' ? array('unique' => true) : array());
$action = 'listCollections';
} else {
if ($action == 'deleteIndex') {
self::$model->{$action}($_GET['collection'], unserialize($_GET['index']));
return $this->_dumpFormVals();
} else {
if ($action == 'getStats') {
$this->mongo[$action] = self::$model->{$action}();
unset($this->mongo['listCollections']);
} else {
if ($action == 'repairDb' || $action == 'getStats') {
$this->mongo[$action] = self::$model->{$action}();
$action = 'listCollections';
} else {
if ($action == 'dropDb') {
self::$model->{$action}();
load::redirect(get::url());
return;
}
}
}
}
}
}
}
if (isset($_GET['collection']) && $action != 'listCollections' && method_exists(self::$model, $action)) {
$this->mongo[$action] = self::$model->{$action}($_GET['collection']);
$this->mongo['count'] = self::$model->count;
$this->mongo['colKeys'] = self::$model->colKeys;
}
if ($action == 'listRows') {
$this->mongo['listIndexes'] = self::$model->listIndexes($_GET['collection']);
} else {
if ($action == 'dropCollection') {
return load::redirect(get::url() . '?db=' . urlencode($_GET['db']));
}
}
}