0
林我有我的用戶模型,這是非常簡單的:CakePHP 2.0:在我的模型的末尾找不到Class'String'?使用CakePHP 2.0</p> <p>
<?php
App::uses('Model', 'Model');
class User extends AppModel {
public $name = 'User';
public $validate = array(
'username' => array(
'required' => array(
'rule' => array('notEmpty'),
'message' => 'A username is required'
)
),
'password' => array(
'required' => array(
'rule' => array('notEmpty'),
'message' => 'A password is required'
)
)
);
public function beforeSave(array $options = array()) {
if (isset($this->data[$this->alias]['password'])) {
$this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);
}
return true;
}
}
?>
不過,我不斷收到以下錯誤:
致命錯誤:類「字符串」不發現在第27行的/home/xxx/app/Model/User.php。
如果我評論beforeSave函數,錯誤消失。
我錯過了什麼?
這做到了。非常感謝! – content01