/** * 定义函数 * */ public function init() { $this->controller = Yii::$app->controller->id; $this->userData = Yii::$app->session->get('userData'); $this->userId = Yii::$app->session->get('userId'); $this->level = Yii::$app->session->get('level'); $this->list = json_decode(file_get_contents(Yii::$app->params['shopUrl']."/cn/course/get-class?data-type=json"),'true'); } /** * 运行覆盖程序 * */ public function run(){ return $this->render('navListening',['level' => $this->level,'list' => $this->list,'controller' => $this->controller,'userData' => $this->userData,'userId' => $this->userId]); } } ?>
*/ 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.
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));
{ 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); } elseif (is_array($type)) { throw new InvalidConfigException('Object configuration must be an array containing a "class" element.'); } else { throw new InvalidConfigException("Unsupported configuration type: " . gettype($type));
* @return static the newly created widget instance */ public static function begin($config = []) { $config['class'] = get_called_class(); /* @var $widget Widget */ $widget = Yii::createObject($config); static::$stack[] = $widget; return $widget; } /**
<script type="text/javascript" src="https://file.viplgw.cn/ui/toefl/cn/js/publicJS.js"></script> <script type="text/javascript" src="https://file.viplgw.cn/ui/toefl/cn/js/vocab.js"></script> </head> <body <?php echo empty($num) ? '' : 'onload="dictationAgain(' . $num . ')"' ?>> <!---------------------头部---------------------------> <?php use app\commands\front\NavListeningWidget; ?> <?php NavListeningWidget::begin(); ?> <?php NavListeningWidget::end(); ?> <!---------------------头部 end---------------------------> <?php $userId = Yii::$app->session->get('userId'); ?> <div class="dicContent clear">
*/ public function renderPhpFile($_file_, $_params_ = []) { ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); require($_file_); return ob_get_clean(); } /** * Renders dynamic content returned by the given PHP statements.
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @throws InvalidParamException if the view cannot be resolved or the view file does not exist. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the path alias of the view file. Please refer to [[render()]] * on how to specify this parameter.
* @param array $params the parameters (name-value pairs) that should be made available in the view. * @return string the rendering result. * @throws InvalidParamException if the view file does not exist. */ public function renderPartial($view, $params = []) { return $this->getView()->render($view, $params, $this); } /** * Renders a view file. * @param string $file the view file to be rendered. This can be either a file path or a path alias. * @param array $params the parameters (name-value pairs) that should be made available in the view.
* @return string * @Obelisk */ public function exitData($arr,$dataType,$view="",$render='1'){ if($dataType == "arr"){ if($render == 1) { return $this->renderPartial($view, $arr); }else{ return $this->render($view, $arr); } }else{ die(json_encode($arr)); }
// if ($id == 19293){ // // }else{ // $content['article_t'] = '托福听力做题-托福听力练习-托福听力TPO-托福听力素材-托福听力解析'; // $content['article_d'] = '雷哥托福官网在线做题练习平台为广大出国留学生提供托福听力做题,托福听力练习,托福听力TPO,托福听力素材,托福听力解析,TPO听力练习,托福听力机经,TPO听力解析,一对一托福培训,托福线上培训等业务.'; // } return $this->exitData($content, $dataType, "carefulListening"); } /** * 泛听页面 * @return string * @yoyo
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$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); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$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();
// default: // break; //} $config = require(__DIR__ . '/../config/web.php'); error_reporting(E_ALL); (new yii\web\Application($config))->run();
$_GET = [ 'id' => '14129', ]; $_SERVER = [ 'REDIRECT_UNIQUE_ID' => 'ZgU@6crSjzww4JdwuLcnHAAAADA', 'REDIRECT_STATUS' => '200', 'UNIQUE_ID' => 'ZgU@6crSjzww4JdwuLcnHAAAADA', 'HTTP_ACCEPT' => '*/*', 'HTTP_USER_AGENT' => 'claudebot', 'HTTP_HOST' => 'toefl.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' => 'toefl.viplgw.cn', 'SERVER_ADDR' => '172.18.175.120', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '44.203.58.132', 'DOCUMENT_ROOT' => '/var/www/html/toeflonline.cn/web', 'REQUEST_SCHEME' => 'http', 'CONTEXT_PREFIX' => '', 'CONTEXT_DOCUMENT_ROOT' => '/var/www/html/toeflonline.cn/web', 'SERVER_ADMIN' => 'root@localhost', 'SCRIPT_FILENAME' => '/var/www/html/toeflonline.cn/web/index.php', 'REMOTE_PORT' => '59270', 'REDIRECT_URL' => '/listening/14129.html', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/listening/14129.html', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php', 'REQUEST_TIME_FLOAT' => 1711619817.7980001, 'REQUEST_TIME' => 1711619817, ]; $_SESSION = [ '__flash' => [], 'testId' => '14129', ];