本文整理汇总了PHP中Route::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::getUrl方法的具体用法?PHP Route::getUrl怎么用?PHP Route::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::getUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
function write($logStr, $logArray = [], $errorType = self::WARNING)
{
if (empty($logStr)) {
return false;
}
if (count($logArray) > 0) {
foreach ($logArray as $key => $value) {
$logStr = str_replace("{" . $key . "}", $value, $logStr);
}
}
$logStr .= "\n";
$folder = $this->customFolder != null ? PATH . DIRECTORY_SEPARATOR . $this->customFolder : LOG;
$file = $this->customFile != null ? $this->customFile : Route::getUrl()[0];
$file .= "_" . date("d-m-Y") . ".log";
$full_path = $folder . DIRECTORY_SEPARATOR . $file;
if (!file_exists($file) and !is_writable($folder)) {
return false;
}
$handler = fopen($full_path, "a");
if ($handler) {
fwrite($handler, "[" . date("H:i:s") . "] [" . $errorType . "] " . $logStr);
} else {
return false;
}
fclose($handler);
return true;
}
示例2: saveRobots
public function saveRobots($data)
{
$file = DIR . '/' . PATH . 'robots.txt';
if (!file_put_contents($file, $data)) {
Bufer::add(array('errors' => 'Ошибка сохранения данных'));
} else {
header("location:" . Route::getUrl('?mode=admin&route=robots_txt&file=robots.txt'));
}
}
示例3: includes
/**
* @param Route $route
* @return bool
*/
public function includes(Route $route)
{
foreach ($this->routes as $match_route) {
if ($route->getUrl() == $match_route->getUrl()) {
return true;
}
}
return false;
}
示例4: saveCss
public function saveCss($css, $fileCss)
{
$path = DIR . '/' . PATH . 'app/css/';
if (!file_put_contents($path . $fileCss, $css)) {
Bufer::add(array('errors' => 'Ошибка сохранения данных'));
} else {
header("location:" . Route::getUrl('?mode=admin&route=css&file=' . $fileCss));
}
}
示例5: deleteUser
public function deleteUser($uid)
{
$result = $this->model->deleteUser($uid);
if ($result['success'] === true) {
header("location:" . Route::getUrl('?mode=admin&route=users'));
} else {
Bufer::add(array('errors' => $result['error']));
}
}
示例6: deleteHtmlSnippet
public function deleteHtmlSnippet($hsid)
{
$hsid = isset($_GET['delete']) ? (int) $_GET['delete'] : 0;
$result = $this->model->deleteHtmlSnippet($hsid);
if ($result['success'] === false) {
Bufer::add(array('errors' => $result['error']));
} else {
header("location:" . Route::getUrl('?mode=admin&route=htmlsnippets'));
}
}
示例7: addsection
public function addsection($data)
{
$sindex = $this->escape($data['sindex']);
$sname = $this->escape($data['sname']);
$sdescription = $this->escape($data['sdescription']);
$sql = "insert into section (sindex,sname,sdescription) values ('" . $sindex . "', '" . $sname . "', '" . $sdescription . "')";
$result = $this->sqlQuery($sql);
if ($result !== false) {
header("location: " . Route::getUrl('?mode=admin&route=sections'));
} else {
return array('success' => false, 'errors' => array('Произошла ошибка при добавлении нового раздела'));
}
}
示例8: Savesection
public function Savesection($data)
{
$sid = (int) $data['sid'];
$sindex = $this->escape($data['sindex']);
$sname = $this->escape($data['sname']);
$sdescription = $this->escape($data['sdescription']);
$sql = "insert into section (sindex,sname,sdescription) values ('" . $sindex . "', '" . $sname . "', '" . $sdescription . "')";
$sql = "update section set \n sindex = '" . $sindex . "',\n sname = '" . $sname . "',\n sdescription = '" . $sdescription . "'\n where sid = " . $sid;
$result = $this->updateData($sql);
if ($result !== false) {
header("location: " . Route::getUrl('?mode=admin&route=editsection&sid=' . $sid));
} else {
return array('success' => false, 'errors' => array('Произошла ошибка при редактировании раздела'));
}
}
示例9: processRoute
/**
* @param array $routeConfig
* @param Route|null $parentRoute
*
* @return Route
*/
private function processRoute(array $routeConfig, Route $parentRoute = null)
{
$name = $routeConfig['name'];
$url = isset($routeConfig['options']['route']) ? $routeConfig['options']['route'] : '';
$controller = isset($routeConfig['options']['defaults']['controller']) ? $routeConfig['options']['defaults']['controller'] : null;
$action = isset($routeConfig['options']['defaults']['action']) ? $routeConfig['options']['defaults']['action'] : null;
if (null !== $parentRoute) {
$name = $parentRoute->getName() . '/' . $name;
$url = $parentRoute->getUrl() . $url;
if (null === $controller) {
$controller = $parentRoute->getController();
}
}
if (null === $action) {
$action = 'index';
}
$action .= 'Action';
return new Route($name, $url, $controller, $action);
}
示例10: array
$errors[] = 'Ошибка удаления папки с превью изображений галереи';
}
if (!@rmdir('uploads/images/galery/' . $glid)) {
$errors[] = 'Ошибка удаления папки галереи';
}
if (isset($errors)) {
return array('success' => false, 'error' => array($errors));
} else {
return array('success' => true);
}
}
public function deleteGalery($glid)
{
return $this->model->deleteGalery($glid);
}
}
$controller = new GaleryController();
$controller->getListGalery();
if (isset($_GET['deletegalery'])) {
$glid = (int) $_GET['deletegalery'];
$deleteFoldersGalery = $controller->deleteAllFoldersGalery($glid);
$result = $controller->deleteGalery($glid);
if ($result['success'] === false) {
Bufer::add(array('errors' => $result['error']));
} else {
header('location: ' . Route::getUrl('?mode=admin&route=galery'));
}
}
$controller->view(ADMIN_TPLS_DIR . '/header.tpl');
$controller->view(ADMIN_TPLS_DIR . '/galery.tpl');
$controller->view(ADMIN_TPLS_DIR . '/footer.tpl');
示例11: go
public static function go($url)
{
echo '<script type="text/javascript">location.href="' . Route::getUrl($url) . '"</script>';
}
示例12: U
/**
* 根据配置文件的URL参数重新生成URL地址
* @param String $path 访问url
* @param array $args GET参数
* <code>
* $args = "nid=2&cid=1"
* $args=array("nid"=>2,"cid"=>1)
* </code>
* @return string
*/
function U($path, $args = array())
{
return Route::getUrl($path, $args);
}
示例13: array
</div>
<?php
}
?>
<div class="row">
<div class="col-md-3">
<div>
<button class="btn btn-success" type="submit" name="saveChanges">Сохранить</button>
<button class="btn btn-default" type="submit" formnovalidate name="cancel">Отмена</button>
</div>
</div>
<div class="col-md-2">
<div>
<?php
if ($canDelete) {
?>
<a class="btn btn-link" href="<?php
echo Route::getUrl('deleteUser', array('userId' => $user->id));
?>
" onclick="return confirm('Вы уверены, что хотите удалить пользователя?')">Удалить</a>
<?php
}
?>
</div>
</div>
</div>
</form>
<?php
include TEMPLATE_PATH . "/include/footer.php";
示例14: recoveryPage
{
$result = $this->model->killPage($pid);
return $result;
}
public function recoveryPage($pid)
{
$result = $this->model->recoveryPage($pid);
return $result;
}
}
$controller = new DeletedpagesController();
if (isset($_GET['killpage'])) {
$delete = $controller->killPage((int) $_GET['killpage']);
if ($delete === false) {
Bufer::set(array('errors' => array('Ошибка при удалении страницы'), 'listPages' => array('data' => $controller->getListPages(), 'paginate' => $controller->paginate()), 'listSections' => $controller->getListSections()));
} else {
header("location: " . Route::getUrl('?mode=admin&route=deletedpages'));
}
}
if (isset($_GET['recoverypage'])) {
$delete = $controller->recoveryPage((int) $_GET['recoverypage']);
if ($delete === false) {
Bufer::set(array('errors' => array('Ошибка при восстановлении страницы'), 'listPages' => array('data' => $controller->getListPages(), 'paginate' => $controller->paginate()), 'listSections' => $controller->getListSections()));
} else {
header("location: " . Route::getUrl('?mode=admin&route=deletedpages'));
}
}
Bufer::set(array('listPages' => array('data' => $controller->getListPages(), 'paginate' => $controller->paginate()), 'listSections' => $controller->getListSections()));
$controller->view(ADMIN_TPLS_DIR . '/header.tpl');
$controller->view(ADMIN_TPLS_DIR . '/deletedpages.tpl');
$controller->view(ADMIN_TPLS_DIR . '/footer.tpl');
示例15: getUrl
/**
*
* @return string URL для перехода в пункт меню
*/
public function getUrl()
{
return Route::getUrl($this->baseAction);
}