my url: http://localhost/MVCfirst/public/Contact/email/anoth
if i use command
Expand|Select|Wrap|Line Numbers
- var_dump($url);
array(3) { [0]=> string(7) "Contact" [1]=> string(5) "email" [2]=> string(5) "anoth" }
where
Expand|Select|Wrap|Line Numbers
- $url=explode('/', filter_var( rtrim($_GET['url'],'/') ), FILTER_SANITIZE_URL);
Expand|Select|Wrap|Line Numbers
- echo '<pre>', print_r($url[0]), '</pre><br>';
- echo '<pre>', print_r($url[1]), '</pre><br>';
- echo '<pre>', print_r($url[2]), '</pre><br>';
Contact1
email1
anoth1
Number 1 is concatenated to the end.
How to get rid of 1 concatenated to the end? Because i need word Contact to proceed to controller file and its methods.
Actually i am following online course:
https://www.udemy.com/learn-php-model-view-controller-pattern-php-mvc/#/lecture/2201044
And they make a line in .htaccess:
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
Maybe this line is the reason that 1 is concatenated?