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 {
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?