【发布时间】:2012-11-22 10:41:19
【问题描述】:
我只是在执行此操作时遇到错误,我不明白为什么。
class Budget_model extends CI_Model
{
// Predefine global class vars
private $current_date = date('j'); // Current day date
private $current_month = date('n'); // Current month date
private $current_year = date('Y'); // Current year
}
这只会给我这个错误,
解析错误:语法错误,意外 '(',期待 ',' 或 ';' in /Applications/MAMP/htdocs/therace/application/models/budget_model.php 在第 7 行
但是为什么呢?我该如何解决这个问题?
【问题讨论】:
-
您是否尝试过在类构造函数中定义它们?
标签: php class codeigniter