If you want just the parts of URL after http://domain.example, try this: <?php echo $_SERVER['REQUEST_URI']; ?> If the current URL was http://domain.example/some-slug/some-id, echo will return only /some-slug/some-id. If you want the full URL, try this: <?php echo 'http...
Answer: Use the PHP $_SERVER Superglobal VariableYou can use the $_SERVER built-in variable to get the current page URL in PHP. The $_SERVER is a superglobal variable, which means it is always available in all scopes.Also if you want full URL of the page you'll need to check the ...
}$this->page = aTools::getCurrentPage();$this->slug =$this->page->slug;//TODO:remove this workaround in 1.5. All uses of actual_slug and real-slug need to go away// in favor of actual_url, we just don't want to break any old overrides in client projects.$this->realSlug = a...
$imgPaths);$this->set('altText',$this->getAltText());$this->set('title',$this->getTitle());$this->set('linkURL',$this->getLinkURL());$this->set('c', Page::getCurrentPage());
$current_url="http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; This code concatenates the protocol, domain, and request URI to form the complete URL of the current page. Example 2: You can also use the$_SERVER['PHP_SELF']superglobal variable to get the path to the current PHP scrip...
may not work with permalinks set to plain global $wp; $current_url = add_query_arg( $wp->query_vars, home_url( $wp->request ) ); // Some other options that may be helpful: $current_url = get_permalink( get_the_ID() ); // for page $current_url = get_category_link( get_qu...
In this tutorial, we will be showing you how to get the current page URL within PHP. The PHP language features super global constants that can contain various information. You can identify one of these global constants by the usage of a single underline at the start of their name. The ...
For a single post or a page URL, ifsingle.php or page.phptheme template file is currently loaded: 1 2 $obj_id=get_queried_object_id(); $current_url=get_permalink($obj_id); For current taxonomy term (eg. category or tag) URL, iftaxonomy.php, category.php, tag.php etc…theme temp...
[pages.length-1];// 当前页面leturl=current.route//当前页面urlletoptions=current.options//如果要获取url中所带的参数可以查看optionsletprevpage=pages[pages.length-2]// 上一个页面letdata=prevpage.data// 获取上一页data里的数据if(prevpage){//存在上一页prevpage.changeDataPageA('load');// 调用上...
用这个方法,可以在不使用$_get[]就可以获取get传过来的参数。还可以获取当前的URL 1publicfunctiongetCurrentUrl() {2$pageURL= 'http';34if($_SERVER["HTTPS"] == "on") {5$pageURL.= "s";6}7$pageURL.= "://";89if($_SERVER["SERVER_PORT"] != "80") {10$pageURL.=$_SERVER["SERVER...