File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11<?php
22namespace Jd ;
33
4+ use \Exception ;
5+
46class JdClient
57{
68 public $ serverUrl = "https://api.jd.com/routerjson " ;
@@ -65,9 +67,8 @@ public function curl($url, $postFields = null)
6567 }
6668 }
6769 $ reponse = curl_exec ($ ch );
68-
6970 if (curl_errno ($ ch )) {
70- throw new \ Exception (curl_error ($ ch ),0 );
71+ throw new Exception (curl_error ($ ch ),0 );
7172 } else {
7273 $ httpStatusCode = curl_getinfo ($ ch , CURLINFO_HTTP_CODE );
7374 if (200 !== $ httpStatusCode ) {
@@ -96,7 +97,11 @@ public function execute($request, $access_token = null)
9697 //签名
9798 $ sysParams ["sign " ] = $ this ->generateSign ($ sysParams );
9899 //系统参数放入GET请求串
99- $ requestUrl = $ this ->serverUrl . "? " ;
100+ if (strpos ($ this ->serverUrl , '? ' ) !== false ) {
101+ $ requestUrl = $ this ->serverUrl . "& " ;
102+ } else {
103+ $ requestUrl = $ this ->serverUrl . "? " ;
104+ }
100105 foreach ($ sysParams as $ sysParamKey => $ sysParamValue ) {
101106 $ requestUrl .= "$ sysParamKey= " . urlencode ($ sysParamValue ) . "& " ;
102107 }
You can’t perform that action at this time.
0 commit comments