how do I set the menu highlight?
protected function isItemActive($item)
{
if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
$route = $item['url'][0];
if ($route[0] !== '/' && Yii::$app->controller) {
$route = ltrim(Yii::$app->controller->module->getUniqueId() . '/' . $route, '/');
}
$route = ltrim($route, '/');
if ($route != $this->route && $route !== $this->noDefaultRoute && $route !== $this->noDefaultAction) {
return false;
}
unset($item['url']['-sharp']);
if (count($item['url']) > 1) {
foreach (array_splice($item['url'], 1) as $name => $value) {
if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
return false;
}
}
}
return true;
}
return false;
}
how does yii2 upload pictures across servers? There is no corresponding expansion package recommendation. Thank you ...
how can yii2 be called across controller calling interfaces, and parameters can be passed in. ...
1. The client passes a value to the server such as: username=admin instantiate a class on the server, and the simple assignment is as follows: $userform=new UserForm (); $userform- > username= "admin "; but if the client passes password= "123456 " ...
I installed the advance version, which runs very fast on other people s virtual machines. It takes me more than 3 seconds to run, just a simple page . enabled, but opcache,session uses redis ask for help, thank you! ...
this is my ActionTimeFilter, so how can I configure it in web.php to enable every action to pass through this filter? Wait online. I ve been in a hurry all day. Is it so good? <?php namespace app filters; use Yii; use yii base Action; use yii ...
the default RESTful, in the advanced application template prompts 405 Method Not Allowed [version 2.0] except GET I follow the similar method of creating a new application body in the advanced application template in this article, copy the Backend app...
** * Excels * * @param string $file * @param array $sheet_names * * @return array|bool * @throws PHPExcel_Exception * @throws PHPExcel_Reader_Exception * public static function importExcel($file, ...
Save large chunks of text with clob if(!$this->validate()){ return false; } $model = new Article(); $model->TITLE = $this->TITLE; $model->CID = $this->CID; $model->CONTENT_DATA = $this->CONTENT_DATA; CONTENT_DATACLOB $model-...
such as the title vendor extension and many are not used, how to make a reasonable choice and delete? ...
the program uses the linked table to get all the field values of the associated table, and uses each () to generate the generator. Each time the value obtained in the loop contains only the data of the main table but not the data of the associated table,...
I am like this now. The project has a lot of databases, all under the same mysql server, and there is db,db2,db3 in main.php. Now there is a storage operation like this. Table A comes from db2,B table and comes from db3,. When using transactions, it is ...
1. For example: I use yii api to write the interface for submitting orders for example, the information in the form is verified at the front end. How can I implement the verification? used to use form model validation rules and load to load data. D...
$order = Orders::find() ->where([ order_sn => $order_sn, user_id => Yii::$app->user->identity->id]) ->all(); { "success": true, "code": 200, "message": "OK",...
problem description this is the expansion pack I want to install: https: github.com jianyan74 . use the command to install composer require jianyan74 yii2-easy-wechat the environmental background of the problems and what methods you have tried ...
use the redis, of the swoole protocol and then implement the connection pool by yourself (just a yii2-swoole written by a big god), which is stored in SplQueue, but I found that after the connection is inside, when it is idle for a long time, these conne...