我在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?中使用引号?请帮我.
我已经堆叠在一个数组的总和.代码如下
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)