Get filename and variable name from url in php which exist in the url
Get the solution ↓↓↓Solution:
Try this if you want get file name only.
print_r(pathinfo("/Your url go here",PATHINFO_BASENAME));
The out will get file name with extension.
Answer
Solution:
Try this, use pathinfo
<?php
$filepath = 'http://dev.proprofs.com/helpdesk/admin/admin.php?t=email';
$path_parts = pathinfo($filepath);
echo "dirname : ".$path_parts['dirname']."\n";
echo "basename : ".$path_parts['basename']."\n";
echo "extension : ".$path_parts['extension']."\n";
echo "filename : ".$path_parts['filename']."\n";
?>
OUTPUT :
dirname : http://dev.proprofs.com/helpdesk/admin
basename : admin.php?t=email
extension : php?t=email
filename : admin
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: filter_sanitize_string deprecated
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.