php get url path name
parse_url( $_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH );
php get url path name
parse_url( $_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH );
php get url infos
$url = 'http://username:password@hostname:9090/path?argument=value#fragment';
var_dump(parse_url($url, PHP_URL_SCHEME)); // http
var_dump(parse_url($url, PHP_URL_USER)); // username
var_dump(parse_url($url, PHP_URL_PASS)); // password
var_dump(parse_url($url, PHP_URL_HOST)); // hostname
var_dump(parse_url($url, PHP_URL_PORT)); // 9090
var_dump(parse_url($url, PHP_URL_PATH)); // /path
var_dump(parse_url($url, PHP_URL_QUERY)); // argument=value
var_dump(parse_url($url, PHP_URL_FRAGMENT)); // fragment
// You can use "parse_str" to parse the URL Query to an Array
$query = parse_url($url, PHP_URL_QUERY);
$queryArray = array();
parse_str($query, $queryArray);
var_dump($queryArray); // array('argument' => 'value')
if browser url is having query string after domain name in it check using php
$url = $_SERVER['REQUEST_URI'];
if (!strpos($url,'mysql')) {
echo 'No mysql.'; //swapped with other echo statement
} else {
echo 'Mysql exists.';
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us