public function actionIndex() { $schemes = Scheme::findPayScheme(); //获取充值方案 $orders = []; $wxPayFunctions = new WxPayFunctions(); foreach ($schemes as $scheme) { array_push($orders, $wxPayFunctions->generateQrOrder($scheme)); } return $this->render('index', ['schemes' => $schemes, 'orders' => $orders]); }
<?php defined('YII_DEBUG') or define('YII_DEBUG', false); defined('YII_ENV') or define('YII_ENV', 'prod'); require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'; require __DIR__ . '/../../common/config/bootstrap.php'; require __DIR__ . '/../config/bootstrap.php'; $config = yii\helpers\ArrayHelper::merge(require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php'); $application = new yii\web\Application($config); $application->language = isset($_COOKIE['language']) ? htmlspecialchars($_COOKIE['language']) : 'zh-CN'; //$application->run(); $postStr = isset($GLOBALS["HTTP_RAW_POST_DATA"]) ? $GLOBALS["HTTP_RAW_POST_DATA"] : ""; if (!empty($postStr)) { \backend\functions\WxPayFunctions::payNotify($postStr); } else { Yii::info('收到空通知', 'wx'); }