AVRIL_START_JANCOKALIVEAVRIL_END_JANCOK
| Server IP : dzynews.com / Your IP : 216.73.217.105 Web Server : nginx/1.30.3 System : Linux cloud-tdkldl-avd6 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 User : www ( 1000) PHP Version : 8.2.31 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/dzynews.com/wp-content/themes/archive-document/Library/payjs/ |
Upload File : |
<?php
class Payjs
{
private $url = 'https://payjs.cn/api/native';
private $key; // 填写通信密钥
private $mchid; // 特写商户号
private $inweixin;
private $callback;
public function __construct($data=null,$key,$mchid,$inweixin,$callback) {
$this->data = $data;
$this->key = $key;
$this->mchid = $mchid;
$this->inweixin = $inweixin;
$this->callback = $callback;
}
public function pay(){
$data = $this->data;
$data['mchid'] = $this->mchid;
$data['callback_url'] = $this->callback;
$data['sign'] = $this->sign($data);
if($this->inweixin){
return 'https://payjs.cn/api/cashier?' . http_build_query($data);
}else{
return $this->post($data, $this->url);
}
}
public function post($data, $url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$rst = curl_exec($ch);
curl_close($ch);
return $rst;
}
public function sign(array $attributes) {
array_filter($attributes);
ksort($attributes);
return strtoupper(md5(urldecode(http_build_query($attributes)) . '&key=' . $this->key));
}
}