我已经为登录系统构建了一个类.我正在使用一个函数来生成128位的盐键.但是当我在服务器(GoDaddy Servers)上运行此函数时,它告诉我thr round()的参数数量是错误的.虽然我已经在本地主机上测试了几次,但一切都很好.
你能看看它并告诉我它有什么问题吗?
function encrypt($str, $len=null) {
return (!empty($len)) ?
hash('sha512', str_pad($str, (strlen($str) + $len),substr(hash('sha512', $str),round(strlen($str)/3, 0,PHP_ROUND_HALF_UP),($len - strlen($str))),STR_PAD_BOTH)) :
hash('sha512', substr($str,round(strlen($str)/3, 0,PHP_ROUND_HALF_UP), 16));
}
Run Code Online (Sandbox Code Playgroud) 我有以下功能:
var appendStructure = {
init : function(wrapper,structure,cls,callback) {
$(wrapper).appendTo(container).hide()
var object = $(container).find(cls);
$(structure.join('')).appendTo(object);
showObj(object,function() {
if(opts.centerObj == true) {
$(window).resize(function() {
var cssProps = getProps(object);
object.css(cssProps);
});
}
if(typeof callback == 'function') {
callback();
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
以及在其中调用的其他函数:
var getProps = function(obj) {
return {
'position' :'absolute',
'top' : (($(window).height() - $(obj).outerHeight()) / 2)+'px',
'left' : (($(window).width() - $(obj).outerWidth()) / 2)+'px'
}
}
var showObj = function(obj,callback) {
return setTimeout(function () {
if(opts.centerObj == true) {
var …Run Code Online (Sandbox Code Playgroud) 我有以下功能:
//Counts The Users In The Database Per Level And Stores The Results In An Array
public function countUsers() {
$users = array();
$length = array();
for( $i = 0; $i >= 2; $i++){
$sql = "SELECT user_id FROM users WHERE user_level = '$i'";
if ($stmt = $this->connect->prepare($sql)) {
$stmt->bind_result($id);
$stmt->execute();
while ($row = $stmt->fetch()) {
$stmt->bind_result($id);
$users[] = $id;
}
$stmt->close();
$length[] = sizeof($users);
} else {
$error = true;
$message['error'] = true;
$message['message'] = CANNOT_PREPARE_DATABASE_CONNECTION_MESSAGE;
return json_encode($message);
} …Run Code Online (Sandbox Code Playgroud) 该_.throttle(function() {}, 250)功能是否仅触发click?因为我试图以一个小延迟运行一些代码,并且由于某种原因它似乎不起作用.
return _.throttle(function() {
return ( $(this).hasClass('dataRevealed') ) ? $(this).addClass('animated fadeOut') : true;
}, 350);
Run Code Online (Sandbox Code Playgroud)
编辑:该函数看起来像这样:
Application.CardView.prototype.removeSimilarCards = function(_container) {
return $(_container).find('[data-identifier="card-view"]').each(function() {
console.log("first");
_.throttle(function() {
console.log("inner");
return ( $(this).hasClass('dataRevealed') ) ? $(this).addClass('animated fadeOut') : true;
}, 350);
});
};
Run Code Online (Sandbox Code Playgroud)