See a source code in this write: The intention is to take the slash, but this column, not take the last p, because-1 is the last one AH
echo $php _self;///index.php
if ('/' = = substr ($php _self,-1)) It's not the right thing to say-1 not the last one?
Reply to discussion (solution)
String substr (string $string, int $start [, int $length])
$rest = substr ("abcdef",-1); Return "F"
If start is a negative number, the returned string starts at the end of the string, starting at the start of the first character.
String substr (string $string, int $start [, int $length])
$rest = substr ("abcdef",-1); Return "F"
If start is a negative number, the returned string starts at the end of the string, starting at the start of the first character.
If according to your reasoning, this if ('/' = = substr ($php _self,-1)) is clearly wrong, but the purpose of this sentence is to judge is the truth of the situation, I do not know Ecshop so write what is going on
String substr (string $string, int $start [, int $length])
$rest = substr ("abcdef",-1); Return "F"
If start is a negative number, the returned string starts at the end of the string, starting at the start of the first character.
If according to your reasoning, this if ('/' = = substr ($php _self,-1)) is clearly wrong, but the purpose of this sentence is to judge is the truth of the situation, I do not know Ecshop so write what is going on
He's going to take INDEX.PHP/FASDFASDFASDFAF, which means taking the back part of index.php.
See if there's a index.php behind.
if ('/' = = substr ($php _self,-1))
Just checking to see if the last character of the $php _self is/
You're not mistaken about the use of functions.
But for the purpose of the algorithm, there is no clear understanding
So, when you look at someone else's code, be sure to experience the author's ideas.
Because of the same effect, you might use a completely polarising algorithm
Different ideas and different ways of writing
For example, I hope $php _self behind.
Then will write $php _self = Trim ($php _self, '/');
I don't care if he's got it removed.
And I hope $php _self behind.
Then it will write $php _self = Trim ($php _self, '/'). ‘/’
It is not necessary to first determine the operation
if ('/' = = substr ($php _self,-1)) This is the check whether the last character/