• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cant use addRedirect()

In the docs in this part 


See this code in Routes.php

$routes->get('/users/profile', 'Users::profile', ['as' => 'profile']);

$routes->get('/users/about', 'Users::about', ['as' => 'about']);

$routes->addRedirect('/users/profile', '/users/about');

Now i should be redirected from {users/profile} when i visit it to {users/about} , instead i have this error

key() expects parameter 1 to be array, string given

i have the Users controller made and inside it profiles and about method , so where is the problem , why isnt it redirecting ?

This is Users controller

<?php namespace App\Controllers;

use CodeIgniter\Controller;

class Users extends Controller
    public function profile()
        echo 'Profile method in User controller';

    public function about()
        echo 'About method in User controller';

Increase Your Awareness

You made an alias and you aren't using it.
PHP Code:

May be like this, haven't tried it:
PHP Code:

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.