How to codeigniter in route
to declare a class
For example, I do like this
class admin extends CI_Controller { public function test() { echo"helloworld"; } }
How can I see the page at http://site.ru/admin/test
How to codeigniter in route
to declare a class
For example, I do like this
class admin extends CI_Controller { public function test() { echo"helloworld"; } }
How can I see the page at http://site.ru/admin/test
To do this, you just need to properly configure .htaccess
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]
Then in the config.php file you need to configure
$config['url_suffix'] = '';
aplications / controllers / admin.php - if so is the controller, then
$route['somme_link'] = 'admin/test';
if the controller is located in a subdirectory, for example aplications / controllers / admin / admin.php, respectively
$route['somme_link'] = 'admin/admin/test';
somme_link is respectively the part of the link (after the domain) that you go to http://site.com/somme_link
Source: https://ru.stackoverflow.com/questions/452016/
All Articles