Corrected URI splitting when last character is a "/"
This commit is contained in:
parent
f2678758fa
commit
5a75d5335e
@ -4,6 +4,9 @@
|
|||||||
$uri = substr ( $request_uri, strlen ( substr ( $php_self, 0, strrpos ( $php_self, 'index.php' ) ) ), strlen ( $request_uri ) - strlen ( substr ( $php_self, 0, strrpos ( $php_self, 'index.php' ) ) ) );
|
$uri = substr ( $request_uri, strlen ( substr ( $php_self, 0, strrpos ( $php_self, 'index.php' ) ) ), strlen ( $request_uri ) - strlen ( substr ( $php_self, 0, strrpos ( $php_self, 'index.php' ) ) ) );
|
||||||
$arr = Array ( );
|
$arr = Array ( );
|
||||||
$last_arg_pos = 0;
|
$last_arg_pos = 0;
|
||||||
|
if ( substr ( $uri, strlen ( $uri ) - 1, 1 ) == "/" ) {
|
||||||
|
$uri = substr ( $uri, 0, strlen ( $uri ) - 1 );
|
||||||
|
}
|
||||||
for ( $i = 1; $i < ( strlen ( $uri ) ) - 1; $i ++ ) {
|
for ( $i = 1; $i < ( strlen ( $uri ) ) - 1; $i ++ ) {
|
||||||
if ( substr ( $uri, $i, 1 ) == "/" && substr ( $uri, $i + 1, 1 ) != "/" && substr ( $uri, $i - 1, 1 ) != "/" ) {
|
if ( substr ( $uri, $i, 1 ) == "/" && substr ( $uri, $i + 1, 1 ) != "/" && substr ( $uri, $i - 1, 1 ) != "/" ) {
|
||||||
$arr [ ] = substr ( $uri, $last_arg_pos, $i - $last_arg_pos);
|
$arr [ ] = substr ( $uri, $last_arg_pos, $i - $last_arg_pos);
|
||||||
|
Reference in New Issue
Block a user