Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
xiaolang
/
expert
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bff6bdd6
authored
Mar 24, 2020
by
xiaolang850403
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公共函数
parent
72f87dc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/main/java/com/asset/common/Common.java
+8
-3
No files found.
src/main/java/com/asset/common/Common.java
View file @
bff6bdd6
package
com
.
asset
.
common
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.UnsupportedEncodingException
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.text.ParseException
;
...
...
@@ -94,7 +95,7 @@ public class Common {
* @return mixed
*/
public
static
boolean
send_msg
(
String
mobile
,
String
msg
)
{
public
static
boolean
send_msg
(
String
mobile
,
String
msg
)
throws
UnsupportedEncodingException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"account"
,
"tbnn30"
);
map
.
put
(
"pswd"
,
"JT2k8yx8"
);
...
...
@@ -115,7 +116,7 @@ public class Common {
* key=value形式的二位数组
* @return
*/
public
static
String
http_build_query
(
Map
<
String
,
Object
>
array
)
{
public
static
String
http_build_query
(
Map
<
String
,
Object
>
array
)
throws
UnsupportedEncodingException
{
String
reString
=
null
;
//遍历数组形成akey=avalue&bkey=bvalue&ckey=cvalue形式的的字符串
Iterator
it
=
array
.
entrySet
().
iterator
();
...
...
@@ -127,7 +128,11 @@ public class Common {
}
reString
=
reString
.
substring
(
0
,
reString
.
length
()
-
1
);
//将得到的字符串进行处理得到目标格式的字符串
reString
=
java
.
net
.
URLEncoder
.
encode
(
reString
);
try
{
reString
=
java
.
net
.
URLEncoder
.
encode
(
reString
,
"utf-8"
);
}
catch
(
UnsupportedEncodingException
e
){
e
.
printStackTrace
();
}
reString
=
reString
.
replace
(
"%3D"
,
"="
).
replace
(
"%26"
,
"&"
);
return
reString
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment