encodeURI方法不会对下列字符编码 ASCII字母 数字 ~!@#$&*()=:/,;?+'encodeURIComponent方法不会对下列字符编码 ASCII字母 数字 ~!*()'所以encodeURIComponent比encodeURI编码的范围更大如果你需要编码整个URL,那么用encodeURI当你需要编码URL中的参数的时候,那么encodeURIComponent是最好方法