## 不烦恼 查看完整档案

|    |
_ | |__ _ _ __ _ | '_ \| | | |/ _` | | |_) | |_| | (_| | |_.__/ \__,_|\__, | |___/ 个人简介什么都没有

## 如何用PHP实现下面的需求（选择题选项随机变化，评论自动调整）

``````这里是试题的标题（内容：线段AB和线段AC相交于D点.......则AB和AC的长度可能为？）

``````

``````这里是试题的标题（内容：线段AB和线段AC相交于D点.......则AB和AC的长度可能为？）

``````

``````这里是试题的标题（内容：线段AB和线段AC相交于D点.......则AB和AC的长度可能为？）

``````

AB错，C也错，D对。

## 哪位大神帮忙看看，微信扫描内置打开是不是不支持canvas

``````<!doctype html>
<html>
<meta charset="utf-8">
<meta name="author" content="m.99m.cn">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>99mi.com</title>
<style>
#guaqian{ display:none;}
.trust{ font-size:12px; width:320px; height:323px; margin:0 auto; background:url(http://trust.99mi.com/trust/bg.jpg) no-repeat center center; overflow:hidden;}
.logo{ width:148px; height:42px; display:inline-block; background:url(http://trust.99mi.com/trust/logo.png) no-repeat; text-indent:-999999px;}
.trust_gua{ width:290px; height:32px; margin:15px 0 0 15px; overflow:hidden;}
canvas{ width:290px; height:32px; overflow:hidden;}
.trust_fhsy{ text-align:center; margin-top:70px; padding-top:10px; background:url(http://trust.99mi.com/trust/xian.png) no-repeat center top;}
.trust_fhsy a{ font-weight:bold; color:#e24040; text-decoration:none;}
@media only screen and (-o-min-device-pixel-ratio: 2/1),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-resolution: 240dpi),
only screen and (min-resolution: 2dppx)
{

.logo{ background-image:url(http://trust.99mi.com/trust/logo@2x.png); background-size:148px 42px;}
.trust_fhsy{ background-image:url(http://trust.99mi.com/trust/xian@2x.png); background-size:323px 1px;}

}
</style>

<body>

<div class="trust">
<p style="text-align:center; margin-top:44px;"><a href="http://m.99m.cn" class="logo">99mi.com</a></p>
<div class="trust_gua">
<img data-original="http://trust.99mi.com/trust/gq.jpg" id="guaqian" />
<canvas/>
<script type="text/javascript">
(function(bodyStyle){
bodyStyle.mozUserSelect = 'none';
bodyStyle.webkitUserSelect = 'none';
var img = new Image();
var canvas = document.querySelector('canvas');
canvas.style.backgroundColor='transparent';
canvas.style.backgroundImage='url(http://trust.99mi.com/trust/gq.jpg)';
canvas.style.position = 'absolute';
var ctx;
var w = img.width, h = img.height;
var offsetX = canvas.offsetLeft, offsetY = canvas.offsetTop;
var mousedown = false;
function layer(ctx){
var img=document.getElementById("guaqian");
var pat=ctx.createPattern(img,"no-repeat");
ctx.fillStyle = pat;
//ctx.fillStyle = 'gray';
ctx.fillRect(0, 0, w, h);
}
function eventDown(e){
e.preventDefault();
mousedown=true;
}
function eventUp(e){
e.preventDefault();
mousedown=false;
}
function eventMove(e){
e.preventDefault();
if(mousedown){
if(e.changedTouches){
e=e.changedTouches[e.changedTouches.length-1];
}
var x = (e.clientX + document.body.scrollLeft || e.pageX) - offsetX || 0,
y = (e.clientY + document.body.scrollTop || e.pageY) - offsetY || 0;
with(ctx){
beginPath()
arc(x, y, 20, 0, Math.PI * 2);
fill();
}
}
}
canvas.width=w;
canvas.height=h;
canvas.style.backgroundImage='url('+img.src+')';
ctx=canvas.getContext('2d');
ctx.fillStyle='transparent';
ctx.fillRect(0, 0, w, h);
layer(ctx);
ctx.globalCompositeOperation = 'destination-out';
});

img.src = 'http://trust.99mi.com/trust/gh.jpg';

})(document.body.style);
</script>
</div>
<p style="text-align:center; margin-top:10px;">亲爱的用户，感谢您对99mi商城的支持和信任</p>
<p style="text-align:center; margin-top:10px;"><strong>如有任何问题，请咨询：400-010-9909</strong></p>
<p class="trust_fhsy"><a href="http://m.99m.cn">回首页 >></a></p>
</div>

</body>
</html>
``````

## 解决关于客户端JS能否等比例压缩图片的请教

```<script language="JavaScript" type="text/javascript">
function DrawImage(ImgD,FitWidth,FitHeight)
{
var image=new Image();
image.data-original=ImgD.src;
if(image.width>0 && image.height>0)
{

if(image.width>FitWidth)
{
ImgD.width=FitWidth;
ImgD.height=(image.height*FitWidth)/image.width;
if(ImgD.height>FitHeight)
{
ImgD.height=FitHeight;
ImgD.width=(image.width*FitHeight)/image.height;
}
}
else if(image.height>FitHeight)
{
ImgD.height=FitHeight;
ImgD.width=(image.width*FitHeight)/image.height;
if(image.width>FitWidth)
{
ImgD.width=FitWidth;
ImgD.height=(image.height*FitWidth)/image.width;
}
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
</script>```

## MVC模式下对数据进行过滤的问题

1、如果在M（或C）层进行数据过滤，方便V层展示数据，但M和V要分别进行一次数组遍历。
2、如果将过滤直接放在V层，只需要一次数组遍历就可以，但又与MVC矛盾，前端处理也不方便。

（其实这个问题在非MVC模式同样存在，只是用MVC好理解一些）

## 如何只用一个加号计算三个数之和？

#### 认证与成就

• 获得 5 次点赞
• 获得 21 枚徽章 获得 0 枚金徽章, 获得 10 枚银徽章, 获得 11 枚铜徽章

(ﾟ∀ﾟ　)

(ﾟ∀ﾟ　)