本文整理汇总了PHP中request::url方法的典型用法代码示例。如果您正苦于以下问题:PHP request::url方法的具体用法?PHP request::url怎么用?PHP request::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::url方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unhandled_public_request
public function unhandled_public_request()
{
$q = $this->connection->prepare("SELECT * FROM `pages` WHERE `url` = :url LIMIT 1");
$q->bindValue(':url', request::url(0), PDO::PARAM_STR);
if (!$q->execute() || $q->rowCount() == 0) {
return false;
}
$page = $q->fetch(PDO::FETCH_ASSOC);
return true;
}
示例2: theme_widget_nav
/**
* ShopEx licence
*
* @copyright Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
* @license http://ecos.shopex.cn/ ShopEx License
*/
function theme_widget_nav($setting)
{
$cur_url = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$setting['max_leng'] = $setting['max_leng'] ? $setting['max_leng'] : 7;
$setting['showinfo'] = $setting['showinfo'] ? $setting['showinfo'] : app::get('b2c')->_("更多");
foreach ($setting['urls'] as $key => $val) {
$ret[$key]['title'] = $val['title'];
$ret[$key]['url'] = url::to($val['link']);
if (request::url() == $ret[$key]['url']) {
$ret[$key]['hilight'] = true;
}
}
return $ret;
//$result;
}
示例3: public_request
/**
* When a public page is requested, check if the url is being redirected
*
* @return boolean
*/
public function public_request()
{
if (!($query = $this->connection->query("SELECT * FROM `redirects`"))) {
return false;
}
$redirects = $query->fetchAll(PDO::FETCH_ASSOC);
foreach ($redirects as $r) {
$from = str_replace('*', '(.*)', $r['from_url']);
if (preg_match('|^' . $from . '$|', request::url(0)) === 1) {
$this->modules->trigger('http_status_301');
$url = preg_replace('|^' . $from . '$|', $r['to_url'], request::url(0));
$this->page->set_status(301);
header('Location:/' . $url, true, 301);
exit;
}
}
return false;
}
示例4: init
/**
* 初始化
*/
private static function init()
{
if (empty(self::$url)) {
self::$url = trim($_SERVER['REQUEST_URI'], '/');
$tmp = explode('?', self::$url);
$params = explode('/', $tmp[0]);
if (count($params) >= 2) {
for ($i = 2; $i < count($params); $i += 2) {
if (isset($params[$i + 1])) {
self::$query_arr[$params[$i]] = removeEmoji($params[$i + 1]);
}
}
self::$controller_name = $params[0];
self::$action_name = $params[1];
}
foreach ($_REQUEST as $key => $val) {
self::$query_arr[$key] = $val;
}
}
}
示例5: url
public static function url($part, $default_value = '')
{
if (is_null(self::$url)) {
$url = self::get('url');
if ($url == 'index.php') {
$url = null;
}
self::$url = explode('/', rtrim($url, '/'));
if (!isset(self::$url[0]) || empty(self::$url[0])) {
self::$url = null;
}
}
if (is_int($part) && !is_null(self::$url)) {
$part--;
if ($part == -1) {
return implode('/', self::$url);
}
if (isset(self::$url[$part])) {
return self::$url[$part];
}
}
return $default_value;
}
示例6: switch
$handler = 'javascript';
break;
case 'jpg':
$handler = 'image';
break;
case 'png':
$handler = 'image';
break;
case 'gif':
$handler = 'image';
break;
case 'jpeg':
$handler = 'image';
break;
case request::url(0):
switch (request::url(1)) {
case 'api':
$handler = 'remote';
break;
case 'cms':
$handler = 'private';
break;
default:
$handler = 'public';
break;
}
break;
default:
echo "OTHER!";
exit;
break;
示例7: location_to
function location_to()
{
//echo request::url(). '#'.$_SERVER['QUERY_STRING'];
if (request::ajax() != true) {
header('Location: ' . request::url() . '#' . $_SERVER['QUERY_STRING']);
}
}
示例8: run_private_controller
public function run_private_controller()
{
foreach ($this->get_modules_enabled() as $module_name) {
if (file_exists(dirname(__FILE__) . '/../../modules/' . $module_name . '/private/controllers/' . request::url(2) . '.php')) {
$this->modules->trigger('handled_private_request');
require_once dirname(__FILE__) . '/../../modules/' . $module_name . '/private/controllers/' . request::url(2) . '.php';
return true;
}
}
return false;
}