functions.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Here is your custom functions.
  4. */
  5. if (!function_exists('http_post')) {
  6. function http_post($url,$params){
  7. $ch = curl_init();
  8. $this_header = array("content-type: application/x-www-form-urlencoded;charset=UTF-8");
  9. curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
  10. curl_setopt($ch, CURLOPT_URL, $url);
  11. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  12. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
  13. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  14. curl_setopt($ch, CURLOPT_POST, 1);
  15. curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
  16. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);//如果不加验证,就设false,商户自行处理
  17. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  18. $output = curl_exec($ch);
  19. curl_close($ch);
  20. return $output;
  21. }
  22. }
  23. if (!function_exists('month_12')){
  24. function month_12(){
  25. $months = [];
  26. for ($i=0;$i<12;$i++){
  27. $months[$i] = date('Y/m',strtotime("-".$i."month"));
  28. }
  29. return $months;
  30. }
  31. }