Make a file with a name hello.phpin the system / application / controllers folder. In the file, put this code:
<?php
class Hello extends Controller
{
function index()
{
echo 'Hello world!';
}
}
?>
Then go to http://localhost/codeigniter/index.php/helloand you will see the world hello. (Perhaps you placed it in a different directory than codeigniter, so change the URL if necessary).
Then you can change the code to:
<?php
class Hello extends Controller
{
function index()
{
echo 'Hello world!';
}
function test()
{
echo 'Second hello world!';
}
}
?>
http://localhost/codeigniter/index.php/hello/test "test" .
.htaccess mod_rewrite, "index.php" URL-, http://localhost/codeigniter/hello http://localhost/codeigniter/hello/test.