echo in codeigniter controller is not working

守給你的承諾、 提交于 2019-12-12 01:37:59

问题


echo in codeigniter controller is not working.. Is there any setting in config to enable echo in codeigniter. All other files are working except those which are having echo in controllers.

 <?php
class Blog extends CI_Controller {

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

Basically iam testing jquery and condeigniter sample script given in http://www.ryantetek.com/2009/12/how-to-create-a-simple-ajax-post-in-codeigniter-using-jquery. but i found script is not working because echo statement in controller. please help me.

error: "This webpage is not available"..


回答1:


I have face the same problem but only in mac browsers and i fixed that with this one In your ./application/config/config.php file check $config['compressed_output'] if it set to true then make it false as some browsers does not support compressed output.




回答2:


Your code is correct. You are likely accessing the wrong path. Do not load the controller directly, because CodeIgniter does freaky stuff with URLs--instead, load a URL similar to the following:

http://yoursite.com/code_igniter_path/index.php/blog/index

Good luck!



来源:https://stackoverflow.com/questions/10520423/echo-in-codeigniter-controller-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!