PHP text operations, retrieve text question domain name: http: // localhost/down. php? Add = down/0522/img.png (domain name is random)
$ Img = $ add
Echo $ img;
?>
========================================================== ======================================
$ Img only obtains the image name (img.png)
That is to say, delete (http: // localhost/down? Add = down/0522/) only (img.png)
What to write? Please.
Reply to discussion (solution)
$ Img = basename ($ _ GET ['add']);
$ Img = basename ($ _ GET ['add']);
Thank you. can you tell me how it works? Newbie solving ,,,
Url parameters are obtained through the $ _ GET array, which is the convention of php.
The basename function is used to obtain the file name (that is, remove the path)
Url parameters are obtained through the $ _ GET array, which is the convention of php.
The basename function is used to obtain the file name (that is, remove the path)
Thank you very much.