Rumah > pembangunan bahagian belakang > tutorial php > 支付宝支付开发的防垂钓的时代已经到来

支付宝支付开发的防垂钓的时代已经到来

WBOY
Lepaskan: 2016-06-13 12:27:56
asal
1432 orang telah melayarinya

支付宝支付开发的防钓鱼的时代已经到来

跳转到支付页面后,支付宝的收银台提示:

支付存在钓鱼风险

错误吗:AE130001040

找到了相应页面:https://cshall.alipay.com/enterprise/help_detail.htm?help_id=474059

在发起支付页面跳转的地方,增加参数“anti_phishing_key”,赋值为

<code class="sourceCode php"><span class="st">&#39;anti_phishing_key&#39;</span> => <span class="fu">urlencode</span><span class="ot">(</span><span class="kw">$this</span>->query_timestamp<span class="ot">()),</span></code>
Salin selepas log masuk

<code class="sourceCode php"><span class="co">/**</span><span class="co">     * 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数</span><span class="co">     * 注意:该功能PHP5环境及以上支持,因此必须服务器、本地电脑中装有支持DOMDocument、SSL的PHP配置环境。建议本地调试时使用PHP开发软件</span><span class="co">     * return 时间戳字符串</span><span class="co">     */</span>    <span class="kw">private</span> <span class="kw">function</span> query_timestamp<span class="ot">(</span><span class="kw">$partner</span><span class="ot">)</span> {        <span class="kw">$url</span> = <span class="kw">$this</span>->gateway_new . <span class="st">"service=query_timestamp&partner="</span> . <span class="fu">trim</span><span class="ot">(</span><span class="fu">strtolower</span><span class="ot">(</span><span class="kw">$partner</span><span class="ot">)</span> . <span class="st">"&_input_charset="</span> . <span class="fu">trim</span><span class="ot">(</span><span class="fu">strtolower</span><span class="ot">(</span><span class="st">&#39;UTF-8&#39;</span><span class="ot">));</span>        <span class="kw">$encrypt_key</span> = <span class="st">""</span><span class="ot">;</span>        <span class="kw">$doc</span> = <span class="kw">new</span> <span class="kw">DOMDocument</span><span class="ot">();</span>        <span class="kw">$doc</span>->load<span class="ot">(</span><span class="kw">$url</span><span class="ot">);</span>        <span class="kw">$itemEncrypt_key</span> = <span class="kw">$doc</span>->getElementsByTagName<span class="ot">(</span><span class="st">"encrypt_key"</span><span class="ot">);</span>        <span class="kw">$encrypt_key</span> = <span class="kw">$itemEncrypt_key</span>->item<span class="ot">(</span><span class="dv">0</span><span class="ot">)</span>->nodeValue<span class="ot">;</span>        <span class="kw">return</span> <span class="kw">$encrypt_key</span><span class="ot">;</span>    }</code>
Salin selepas log masuk
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan