小编jam*_*har的帖子

php引号无效

我在PHP代码中遇到了一些问题.这是一个基本问题,但我不知道答案.代码在这里:

echo '<a href="profile.php?act=show&id=<?=$_SESSION['id']?>&line=true" class="myac">My Data</a>';
Run Code Online (Sandbox Code Playgroud)

如何在id?中使用引号?请帮我.

php

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

JavaScript和函数

我已经堆叠在一个数组的总和.代码如下

function User(name,email) {
        this.name = name;
        this.email = email;
        this.cartAmount = [];
        this.total = 0;
}
User.prototype = {
        constructor: User,

        addCart: function(mrp){
            this.cartAmount.push(mrp);
        },

        changeEmail: function(newmail){
            this.email = newmail;
        },

        showCart: function() {
            var cart = this.cartAmount.length >0 ? this.cartAmount.join("tk,") : "No product in the cart";
            return this.name+" has "+cart+" in his cart.";
        },

        intotal: function(){
            for(var n in this.cartAmount){
                this.total += this.cartAmount[n];
                return this.total;
            }
        }
    };
    athar= new User("Athar Jamil", "atharjamil@gmail.com");
    console.log(athar.name);
    athar.changeEmail("atharjamil@yahoo.com");
    console.log(athar.email);
    athar.addCart(20);
    athar.addCart(50); …
Run Code Online (Sandbox Code Playgroud)

javascript arrays loops return sum

-1
推荐指数
3
解决办法
7741
查看次数

标签 统计

arrays ×1

javascript ×1

loops ×1

php ×1

return ×1

sum ×1