How can I get the script name? If my current script is index. php, how can I get the index ?, Basename (); check the manual, $ str = & quot; index. php & quot; $ str = strsub ($ str, 0,-4); // Obtain the last and fourth places from the first place, that is, obtain the script name. how can this problem be solved?
Assume that my current script is index. php.
I want to get the index
How can this problem be solved?
------ Solution --------------------
Basename ();
Look at the manual
------ Solution --------------------
$ Str = "index. php ";
$ Str = strsub ($ str, 0,-4); // get the last and fourth digits from the first place, that is, get something before. php!
Echo $ str;
Or use a string to separate! But I think that's troublesome!
------ Solution --------------------
$ _ SERVER ['script _ filename']
------ Solution --------------------
Basename ($ _ SELF, '. php ')
------ Solution --------------------
Same as above
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.