当前位置: 首页>>代码示例>>PHP>>正文


PHP Router::createUrl方法代码示例

本文整理汇总了PHP中Router::createUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::createUrl方法的具体用法?PHP Router::createUrl怎么用?PHP Router::createUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Router的用法示例。


在下文中一共展示了Router::createUrl方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Bese controller constructor: restores user object by using session data and
  * checks a permission to a requested action
  *
  * @param LiveCart $application Application instance
  * @throws AccessDeniedExeption
  */
 public function __construct(LiveCart $application)
 {
     parent::__construct($application);
     $this->router = $this->application->getRouter();
     if (!$application->isInstalled() && !$this instanceof InstallController) {
         header('Location: ' . $this->router->createUrl(array('controller' => 'install', 'action' => 'index')));
         exit;
     }
     unset($this->locale);
     unset($this->config);
     unset($this->user);
     unset($this->session);
     $this->checkAccess();
     $this->application->setRequestLanguage($this->request->get('requestLanguage'));
     $this->configFiles = $this->getConfigFiles();
     $this->application->setConfigFiles($this->configFiles);
     $localeCode = $this->application->getLocaleCode();
     // add language code to URL for non-default languages
     if ($localeCode != $this->application->getDefaultLanguageCode()) {
         $this->router->setAutoAppendVariables(array('requestLanguage' => $localeCode));
     }
     // verify that the action is accessed via HTTPS if it is required
     if ($this->router->isSSL($this->request->getControllerName(), $this->request->getActionName()) && !$this->router->isHttps()) {
         header('Location: ' . $this->router->createFullUrl($_SERVER['REQUEST_URI'], true));
         exit;
     }
 }
开发者ID:saiber,项目名称:www,代码行数:34,代码来源:BaseController.php

示例2: links

 public static function links($current, $all, $perPage = 50)
 {
     $view = new View('pagination');
     $view->total_pages = ceil($all / $perPage);
     $view->current_page = $current;
     $view->per_page = $perPage;
     $view->previous_page = $current > 0 ? $current - 1 : false;
     $view->next_page = $current + 1 < $all ? $current + 1 : false;
     $view->url = Router::createUrl(array('page' => '{page}'));
     return $view->render();
 }
开发者ID:nemis,项目名称:Fm,代码行数:11,代码来源:pagination.php

示例3: smarty_function_createUrl

function smarty_function_createUrl($param, &$smarty)
{
    $project = isset($param['project']) ? $param['project'] : '';
    $controller = isset($param['controller']) ? $param['controller'] : '';
    $action = isset($param['action']) ? $param['action'] : '';
    $baseUrl = isset($param['baseUrl']) ? $param['baseUrl'] : '';
    $params = isset($param['params']) ? $param['params'] : '';
    $delParams = isset($param['delParams']) ? $param['delParams'] : '';
    $addParams = isset($param['addParams']) ? $param['addParams'] : '';
    $baseUrl = isset($param['baseUrl']) ? $param['baseUrl'] : '';
    if (!empty($delParams)) {
        return Router::delUrlParams($controller, $action, $delParams, $project, $baseUrl);
    }
    if (!empty($addParams)) {
        return Router::addUrlParams($controller, $action, $addParams, $project, $baseUrl);
    }
    return Router::createUrl($controller, $action, $params, $project, $baseUrl);
}
开发者ID:az0ne,项目名称:diaoyu,代码行数:18,代码来源:function.createUrl.php

示例4: __construct

 /**
  * 翻页页码初始化
  * @param int $totalNum 总条数
  * @param int $pageSize 每页显示条数 
  * @param int $params 链接参数,默认为空时使用$_GET
  * @param int $pName 翻页页码数参数名称,默认为page
  * @return void
  */
 public function __construct($totalNum, $pageSize, $params = array(), $pName = 'page')
 {
     $pageSize = intval($pageSize);
     if (empty($pageSize)) {
         return false;
     }
     empty($params) && ($params = BaseModelRouter::$get);
     //基本数据计算
     $this->totalNum = max(intval($totalNum), 0);
     //自然数
     $this->pageSize = max($pageSize, -1 * $pageSize);
     //自然数,当$pageSize=0时不分页
     $this->params = $params;
     empty($pName) || ($this->pName = $pName);
     $this->page = isset($this->params[$this->pName]) ? max($this->params[$this->pName], 1) : 1;
     $this->totalPage = ceil($this->totalNum / $this->pageSize);
     // $this->page = min($this->page, $this->totalPage);
     $this->prePage = max($this->page - 1, 1);
     //上一页
     $this->nextPage = min($this->page + 1, $this->totalPage);
     //下一页
     $this->lastPage = $this->totalPage;
     //最后一页
     //limit计算
     $this->page || ($this->page = 1);
     $this->limit = " LIMIT " . ($this->page - 1) * $this->pageSize . ', ' . $this->pageSize;
     //用于 MySQL 分页生成语句
     //url参数计算
     unset($this->params[$this->pName]);
     if (defined('QUEUE') || defined('EXTERN')) {
         $this->paramStr = "?" . http_build_query($this->params);
     } else {
         $this->paramStr = Router::createUrl('', '', $this->params);
     }
     if (strpos($this->paramStr, '?') !== false) {
         $this->paramStr .= '&';
     } else {
         $this->paramStr .= '?';
     }
     return;
 }
开发者ID:az0ne,项目名称:diaoyu,代码行数:49,代码来源:BaseModelPage.php

示例5: foreach

<tr class="crud-search-tr">
<td>&nbsp;</td>
<?php 
foreach ($columns as $column => $name) {
    echo '<td>';
    echo '<input type="text" class="crud-search-field" name="search[' . $column . ']" value="' . (isset($_GET['search']['column']) ? htmlspecialchars($_GET['search']['column']) : '') . '">';
    echo '</td>';
}
?>
</tr>
<?php 
foreach ($iterations as $row) {
    echo '<tr>';
    echo '<td><input type="checkbox" name="ids[' . $row->id . ']"' . ((isset($_GET['ids'][$row->id]) and $_GET['ids'][$row->id] == 'on') ? ' checked="checked"' : '') . '/></td>';
    foreach ($columns as $column => $name) {
        echo '<td onclick="document.location = \'' . Router::createUrl(array('id' => $row->id)) . '\'">' . $row->{$column} . '</td>';
    }
    echo '</tr>';
}
?>
</table>
<?php 
if ($countAll > 0) {
    ?>
<a href="javascript:document.getElementById('crud-form').submit()"><?php 
    echo Dict::word('delete marked');
    ?>
</a>
|
<?php 
}
开发者ID:nemis,项目名称:Fm,代码行数:31,代码来源:crud_table.php

示例6: htmlspecialchars

<form method="post" action="<?php 
echo Router::createUrl(array(), false, false);
?>
" class="crud-form">
<fieldset>
<table>
<?php 
foreach ($model->fields() as $column => $name) {
    echo '<tr>';
    echo '<td>' . $name . '</td>';
    echo '<td><input type="text" name="data[' . $column . ']" value="' . htmlspecialchars($model->{$column}) . '"/>';
}
?>
</table>
<input type="hidden" name="id" value="<?php 
echo $model->id;
?>
"/>
<input type="submit" class="submit" value="<?php 
echo Dict::word('Save');
?>
"/>
</fieldset>
</form>
开发者ID:nemis,项目名称:Fm,代码行数:24,代码来源:crud_form.php

示例7: createUrl

 /**
  * 网址(URL)组装操作
  *
  * 注:组装绝对路径的URL
  *
  * @access public
  *
  * @param string $route controller与action。例:controllerName/actionName
  * @param array $params URL路由其它字段。注:url的参数信息
  *
  * @return string
  */
 public static function createUrl($route, $params = array())
 {
     //参数分析
     if (!$route) {
         return false;
     }
     return Router::createUrl($route, $params);
 }
开发者ID:a53abc,项目名称:doitphp,代码行数:20,代码来源:View.class.php

示例8: testRouteNotFound

 public function testRouteNotFound()
 {
     $this->setExpectedException('Http\\RouterException');
     $router = new Router();
     $router->createUrl('404');
 }
开发者ID:mitallast,项目名称:php-http-router,代码行数:6,代码来源:RouterTest.php

示例9: createUrl

 /**
  * 网址(URL)组装操作
  *
  * 注:组装绝对路径的URL
  *
  * @access public
  *
  * @param string $route controller与action。例:controllerName/actionName
  * @param array $params URL路由其它字段。注:url的参数信息
  *
  * @return string
  */
 public static function createUrl($route, $params = array())
 {
     return Router::createUrl($route, $params);
 }
开发者ID:a53abc,项目名称:doitphp,代码行数:16,代码来源:Controller.class.php


注:本文中的Router::createUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。