sgs Posted January 23, 2015 Share 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. Quote Link to comment Share on other sites More sharing options...
Byron Posted January 23, 2015 Share 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.