小编Rol*_*and的帖子

PHP函数在服务器和localhost上的行为不同

我已经为登录系统构建了一个类.我正在使用一个函数来生成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)

php hash rounding

0
推荐指数
1
解决办法
190
查看次数

函数运行期间发生奇怪错误

我有以下功能:

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)

javascript console jquery function

0
推荐指数
1
解决办法
60
查看次数

按用户级别从MySql表中选择所有ID,并将每个级别的ID数存储在数组中?

我有以下功能:

//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)

php mysql arrays

0
推荐指数
1
解决办法
1078
查看次数

Underscore的油门功能不会触发

_.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)

javascript underscore.js

0
推荐指数
1
解决办法
3034
查看次数

标签 统计

javascript ×2

php ×2

arrays ×1

console ×1

function ×1

hash ×1

jquery ×1

mysql ×1

rounding ×1

underscore.js ×1