duannian3494 2014-09-16 16:10
浏览 25
已采纳

关于localhost问题的CodeIgniter

Well< I try to run CodeIgniter on my localhost with MAMP. I've changed base_url in config.php on $config['base_url'] = 'http://localhost:8888/codeigniter'; Also I've created blog.php as in tutorial I use:

<?php
class Blog extends Controller {

    function index()
    {
        echo 'Hello World!';
    }
}
?>

But, when I go to http://localhost:8888/codeigniter/index.php/blog/, there is output of my index.php ('test' - string) but there is no hello world there, what am I doing wrong?

  • 写回答

1条回答 默认 最新

  • duanhuan5409 2014-09-16 17:15
    关注

    the biggest breaking change between Codeigniter 1.7 -- which many tutorials are based on -- and Codeigniter 2 is the first line of code in the controllers and models

    class Blog extends Controller {
    

    change that to

    class Blog extends CI_Controller {
    

    same for models

    class Donotmakemodeljokes extends CI_Model {
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?