排除意外的T_PUBLIC

时间:2015-11-09 21:48:42

标签: php parsing

我收到此错误.. 解析错误:语法错误,第573行C:\ filename中的意外T_PUBLIC

在这一行......

<i>public function findMaterialPostedThisMonth(){ </i>

代码......

public function findMaterialPostedThisMonth(){  
                    if (!empty($_GET['time'])) {
                            $month = date('n', $_GET['time']);
                            $year = date('Y', $_GET['time']);
                            if (!empty($_GET['pnc']) && $_GET['pnc'] == 'n') $month++;
                            if (!empty($_GET['pnc']) && $_GET['pnc'] == 'p') $month--;
                    } 
                    else {
                            $month = date('n');
                            $year = date('Y');
                    }

                    return $this->findAll(array(
                            'condition'=>'create_time > :time1 AND create_time < :time2
                                            AND t.status='.self::STATUS_PUBLISHED,
                            'params'=>array(':time1' => date("Y-m-d", mktime(0,0,0,$month,1,$year)),
                                            ':time2' => date("Y-m-d", mktime(0,0,0,$month+1,1,$year)),
                                    ),
                            'order'=>'t.create_time DESC',
                    ));
            }

1 个答案:

答案 0 :(得分:0)

除非在类中声明函数,否则摆脱public