[PHP5.3+] Get the address url in getCurrentUrl()

1. When calling the methods of other extensions or classes in the controller, the getCurrentUrl() method is the route obtained from the [method under the current controller], not the route of [other extensions or class methods]! ! !

2. The getCurrentUrl() method code:

/**
     * get the current url
     * @return string
     */
    public static function getCurrentUrl() {
        $pageURL = 'http';
        if (@$_SERVER["HTTPS"] == "on") {
            $pageURL .= "s";
        }
        $ pageURL . = ": //" ;
        $ pageURL . = $ _SERVER ['HTTP_HOST']. $ _SERVER ['REQUEST_URI' ];
        return  $ pageURL ;
    }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324938073&siteId=291194637