Get the self URL of current page
2006-04-23 17:23
495 查看
<?php
function selfURL() {
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2) {
return substr($s1, 0, strpos($s1, $s2));
}
?>
function selfURL() {
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2) {
return substr($s1, 0, strpos($s1, $s2));
}
?>
相关文章推荐
- How to get the url of a page in OpenERP?
- PHP Get the Current Page URL
- PHP: How to Get the Current Page URL
- GetPageHTML - Get the HTML code for a given URL
- How do I get the path of the current executed file in Python?
- Can I get rid of the "This page contains both secure and nonsecure items" warning?
- Get Current URL Attributes in Zend With The Request Object
- Vim tips: get the name of the current file
- Get the Url of a Hyperlink when the Mouse moves Over a TWebBrowser Document
- How to get the HTML source of a webpage in Ruby
- URL-encoded form data is not valid ,Operation is not valid due to the current state of the object
- Including a Django app's url.py is resulting in a 404 (The current URL, rango/, didn't match any of)
- [Yii Framework] How to get the current static page name?
- [Drupal] How to get the real path of a node, no matter it is a path or a url alias
- get current url in current page
- Get the Url of a Hyperlink when the Mouse moves Over a TWebBrowser Document
- How To Retrieve the URL of a Web Page from an ActiveX Control
- Updates were rejected because the tip of your current branch is behind
- UTL_HTTP Call a Web Service and Pass Parameters as Part of the URL
- More than one way to get the max of 3 numbers.