本文整理汇总了PHP中YumUser::generateSalt方法的典型用法代码示例。如果您正苦于以下问题:PHP YumUser::generateSalt方法的具体用法?PHP YumUser::generateSalt怎么用?PHP YumUser::generateSalt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YumUser
的用法示例。
在下文中一共展示了YumUser::generateSalt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate($mode)
{
switch($mode)
{
case 'user':
$model = new YumUser;
$profile = new YumProfile;
break;
default:
}
$username = $_POST['username'] or $this->_sendResponse(
501, 'Username missing');
$password = $_POST['password'] or $this->_sendResponse(
501, 'Password missing');
foreach($_POST as $key => $value)
if($profile->hasAttribute($key))
$profile->$key = $value;
if($profile->validate() && $model->register($username, $password, $profile, YumUser::generateSalt()))
$this->_sendResponse(200,
CJSON::encode(array($model, $profile)));
else {
$msg = "<h1>Error</h1>";
$msg .= sprintf("Couldn't create %s", $mode);
$msg .= "<ul>";
foreach($model->errors as $attribute => $attr_errors) {
$msg .= "<li>Attribute: $attribute</li>";
$msg .= "<ul>";
foreach($attr_errors as $attr_error)
$msg .= "<li>$attr_error</li>";
$msg .= "</ul>";
}
foreach($profile->errors as $attribute => $attr_errors) {
$msg .= "<li>Attribute: $attribute</li>";
$msg .= "<ul>";
foreach($attr_errors as $attr_error)
$msg .= "<li>$attr_error</li>";
$msg .= "</ul>";
}
$msg .= "</ul>";
$this->_sendResponse(500, $msg );
}
}