用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2518|回复: 4
收起左侧

[已解决] 求助。偶尔大量出现Use of undefined constant index - assumed 'index'

[复制链接]
发表于 2013-12-2 10:41:32 | 显示全部楼层 |阅读模式
我在调试页面时偶尔出现大量Use of undefined constant index - assumed 'index'错误。但是什么也没改,重新加载页面后又正常了。
又遇到过这个问题的吗,请帮忙看看什么原因,谢谢。

2013-12-02 10:31:16 --> Severity: Notice  --> Use of undefined constant index - assumed 'index' ...\application\controllers\main.php 929
ERROR - 2013-12-02 10:31:16 --> Severity: Notice  --> Use of undefined constant index - assumed 'index' ...\application\controllers\main.php 929
ERROR - 2013-12-02 10:31:16 --> Severity: Notice  --> Use of undefined constant index - assumed 'index' ...\application\controllers\main.php 929
ERROR - 2013-12-02 10:31:16 --> Severity: Notice  --> Use of undefined constant index - assumed 'index' ...\application\controllers\main.php 929
ERROR - 2013-12-02 10:31:16 --> Severity: Notice  --> Use of undefined constant index - assumed 'index' ...\application\controllers\main.php 929

发表于 2013-12-2 18:58:26 | 显示全部楼层
贴 main.php 929 行代码
 楼主| 发表于 2013-12-3 10:00:19 | 显示全部楼层
Hex 发表于 2013-12-2 18:58
贴 main.php 929 行代码

是获取当前系统时间的毫秒部分的代码。for那一行。
function get_millisecond()
        {
                list($usec, $sec) = explode(" ", microtime());
                $msec=round($usec*1000);
                $len = strlen($msec);
                if($len<3){
                        for($index =0; index<3-$len; $index++)
                        {
                                $msec = '0'.$msec;
                        }
                }
                return $msec;
                       
        }

发表于 2013-12-3 11:31:40 | 显示全部楼层
li_lzw 发表于 2013-12-3 10:00
是获取当前系统时间的毫秒部分的代码。for那一行。
function get_millisecond()
        {

很明显,你少写了一个$符号
应该是 $index 你写成 index 了。

发表于 2013-12-4 21:28:23 | 显示全部楼层
这样还能有不报错的时候?

本版积分规则