sgs Posted January 23, 2015 Posted January 23, 2015 Hi, I want to know that, how to get the value of a query string of clean url. For example, I want to get "idvalue" fromhttp://www.domain.tk/idvalueand the above url points to:http://www.domain.tk/file.php?id=idvaluePlease help me.
Byron Posted January 23, 2015 Posted January 23, 2015 http://bybyron.net/test/get-file-ext-b.php <?php $url = "http://www.domain.tk/idvalue"; $extract = pathinfo($url); $dname = ($extract['dirname']); $file = ($extract['filename']); $ext = ($extract['basename']); echo "$dname<br>"; # echo "$file<br>"; echo "$ext"; ?> http://bybyron.net/test/get-url-parts-b.php <?php $url = "http://www.domain.tk/idvalue"; $url_parts = parse_url($url); print_r($url_parts); $scheme = ($url_parts['scheme']); $host = ($url_parts['host']); $path = ($url_parts['path']); echo "<br><br>"; echo "Scheme: $scheme<br>"; echo "Host: $host<br>"; echo "Path: $path"; ?> 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now