doudou_3636 2013-09-25 22:01
浏览 30

无法找到常量ONLINE [关闭]

am using CodeIgniter and i keep get a error from the config file

A PHP Error was encountered
Severity: Warning
Message: constant() [function.constant]: Couldn't find constant ONLINE
Filename: libraries/co.php
Line Number: 534


A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/baahoot/public_html/Outlaws/system/core/Exceptions.php:185)
Filename: helpers/url_helper.php
Line Number: 542

i am not sure what i am doing wrong this is a working code from git hub. I am new to php and would like to see how this worked on arvixe server using the mysql db anyone know how to fix this type of error??

libraries/co.php somewhere around :534

function __construct() { 
    $CI =& get_instance(); 
    //$CI->form_validation->set_error_delimiters( '<br /><div class="response error-note">Error: ', '</div>' ); 
    if(constant('ONLINE') == FALSE): 
        //$CI->output->enable_profiler(TRUE); endif; 
    if(1 == 0 && constant('ONLINE') == TRUE ) { 
        echo $CI->load->view('temporary', '', true); exit; 
    } $CI->load->config('redis'); 
    $this->redis = ($CI->config->item('redis_active')); 
}
  • 写回答

1条回答

  • dongningce9075 2013-09-26 05:38
    关注

    Just use project-wide case sensitive search on word ONLINE, any modern IDE and even editors have this functionality.

    See where it's used and see if it's defined somewhere. If not - see what depends on it and define somewhere in the project. It's a constant, not a variable, so it's a simple value you hard-code in your project, so there should be no problem with getting to know what it should be.

    You may even try setting it to true, but that's just a guess. For further help, please update your question with the code from the method at

    Filename: libraries/co.php
    Line Number: 534
    

    EDIT:

    after you provided the code, I recommend to just make a dirty hack and add these lines to the __construct method right in the beginning so it would look like this.

    function __construct() {
        if(!defined('ONLINE')) {
            define('ONLINE', true);
        }
    

    If it will throw errors, try false instead of true. As I understand, this constant if true means that the page is in production, and in development if false, so play around as you wish.

    Consider cleaning up all the code.

    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置