}elseif(!empty(preg_match('/https:\/\/gre.viplgw.cn\/experience\/(\d+).html/',$url,$a))){ $seo = Seo::findOne(38); }elseif(!empty(preg_match('/https:\/\/gre.viplgw.cn\/beikao\/(.*)\/(\d+).html/',$url,$a))){ $seo = Seo::findOne(48); } if (!empty($seo)){ if ($seo['id'] == 34){ //TODO 课程title $model = new Content(); $course = $model->getClass(['fields' => 'commencement,price','where' =>"c.id={$a[1]}"])[0]; $t = $course['title'].$course['catName']; $d = $seo['description']; $k = $course['title'].$course['catName']; }elseif($seo['id'] == 36){ //TODO 刷题活动 $brush = self::curl_post("https://open.viplgw.cn/cn/api/app-open-details", ['id' => $a[1]]); $brush = @json_decode($brush,true)['data']; $t = $brush['title'].$brush['catName']; $d = $seo['description'];
class CourseController extends ToeflController { public $enableCsrfValidation = false; public $layout = 'cn'; public $greUrl; public $ip; function init (){ parent::init(); $this->type =3; $this->greUrl = "https://gre.viplgw.cn"; } /** * GRE课程页 * by yanni
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
* @param array $config name-value pairs that will be used to initialize the object properties. */ public function __construct($id, $module, $config = []) { $this->id = $id; $this->module = $module; parent::__construct($config); } /** * Declares external actions for the controller. * This method is meant to be overwritten to declare external actions for the controller. * It should return an array, with array keys being action IDs, and array values the corresponding
foreach ($params as $index => $param) { $dependencies[$index] = $param; } $dependencies = $this->resolveDependencies($dependencies, $reflection); if (empty($config)) { return $reflection->newInstanceArgs($dependencies); } if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies);
foreach ($params as $index => $param) { $dependencies[$index] = $param; } $dependencies = $this->resolveDependencies($dependencies, $reflection); if (empty($config)) { return $reflection->newInstanceArgs($dependencies); } if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies);
public function get($class, $params = [], $config = []) { if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
* @throws InvalidConfigException if the configuration is invalid. * @see \yii\di\Container */ public static function createObject($type, array $params = []) { if (is_string($type)) { return static::$container->get($type, $params); } elseif (is_array($type) && isset($type['class'])) { $class = $type['class']; unset($type['class']); return static::$container->get($class, $params, $type); } elseif (is_callable($type, true)) { return call_user_func($type, $params);
$className = ltrim($this->controllerNamespace . '\\' . str_replace('/', '\\', $prefix) . $className, '\\'); if (strpos($className, '-') !== false || !class_exists($className)) { return null; } if (is_subclass_of($className, 'yii\base\Controller')) { $controller = Yii::createObject($className, [$id, $this]); return get_class($controller) === $className ? $controller : null; } elseif (YII_DEBUG) { throw new InvalidConfigException("Controller class must extend from \\yii\\base\\Controller."); } else { return null; }
if (($pos = strrpos($route, '/')) !== false) { $id .= '/' . substr($route, 0, $pos); $route = substr($route, $pos + 1); } $controller = $this->createControllerByID($id); if ($controller === null && $route !== '') { $controller = $this->createControllerByID($id . '/' . $route); $route = ''; } return $controller === null ? false : [$controller, $route];
if (isset($this->controllerMap[$id])) { $controller = Yii::createObject($this->controllerMap[$id], [$id, $this]); return [$controller, $route]; } $module = $this->getModule($id); if ($module !== null) { return $module->createController($route); } if (($pos = strrpos($route, '/')) !== false) { $id .= '/' . substr($route, 0, $pos); $route = substr($route, $pos + 1); }
* @param array $params the parameters to be passed to the action * @return mixed the result of the action. * @throws InvalidRouteException if the requested route cannot be resolved into an action successfully */ public function runAction($route, $params = []) { $parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params);
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/../vendor/autoload.php'); require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); error_reporting(E_ALL); //(new yii\web\Application($config))->run(); (new yii\web\Application($config))->run();
$_GET = [ 'id' => '8844', ]; $_SERVER = [ 'REDIRECT_UNIQUE_ID' => 'ZgZ5FjPe9xMwUbt59Kp85wAAADM', 'REDIRECT_STATUS' => '200', 'UNIQUE_ID' => 'ZgZ5FjPe9xMwUbt59Kp85wAAADM', 'HTTP_ACCEPT' => '*/*', 'HTTP_USER_AGENT' => 'claudebot', 'HTTP_HOST' => 'gre.viplgw.cn', 'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.6.40', 'SERVER_NAME' => 'gre.viplgw.cn', 'SERVER_ADDR' => '172.18.175.120', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '54.242.165.255', 'DOCUMENT_ROOT' => '/var/www/html/gre/web', 'REQUEST_SCHEME' => 'http', 'CONTEXT_PREFIX' => '', 'CONTEXT_DOCUMENT_ROOT' => '/var/www/html/gre/web', 'SERVER_ADMIN' => 'root@localhost', 'SCRIPT_FILENAME' => '/var/www/html/gre/web/index.php', 'REMOTE_PORT' => '57508', 'REDIRECT_URL' => '/course/8844.html', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/course/8844.html', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php', 'REQUEST_TIME_FLOAT' => 1711700246.0350001, 'REQUEST_TIME' => 1711700246, ]; $_SESSION = [ '__flash' => [], ];